Skip to content

Commit

Permalink
Uplift of #7935 (squashed) to beta
Browse files Browse the repository at this point in the history
  • Loading branch information
brave-browser-releases committed Feb 12, 2021
1 parent 0814d47 commit 4ded398
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
5 changes: 5 additions & 0 deletions browser/ui/brave_actions/brave_action_view_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ bool BraveActionViewController::TriggerPopupWithUrl(
PopupShowAction show_action,
const GURL& popup_url,
bool grant_tab_permissions) {
// If this extension is currently showing a popup, hide it. This behavior is
// a bit different than ExtensionActionViewController, which will hide any
// popup, regardless of extension. Consider duplicating the original behavior.
HidePopup();

std::unique_ptr<extensions::ExtensionViewHost> host =
extensions::ExtensionViewHostFactory::CreatePopupHost(popup_url,
browser_);
Expand Down
17 changes: 17 additions & 0 deletions components/brave_rewards/browser/test/rewards_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "base/time/time_override.h"
#include "bat/ledger/internal/uphold/uphold_util.h"
#include "brave/browser/brave_rewards/rewards_service_factory.h"
#include "brave/browser/extensions/api/brave_action_api.h"
#include "brave/common/brave_paths.h"
#include "brave/components/brave_rewards/browser/rewards_service_impl.h"
#include "brave/components/brave_rewards/browser/test/common/rewards_browsertest_context_helper.h"
Expand Down Expand Up @@ -505,4 +506,20 @@ IN_PROC_BROWSER_TEST_F(RewardsBrowserTest, BAPCutoffAfter) {
}
}

IN_PROC_BROWSER_TEST_F(RewardsBrowserTest, BAPPopup) {
// Open the rewards popup.
content::WebContents* popup_contents = context_helper_->OpenRewardsPopup();
ASSERT_TRUE(popup_contents);

// Attempt to open the BAP deprecation popup at the same time. The rewards
// panel popup should close. If both popups are shown at the same time, this
// test will crash on exit.
std::string error;
bool popup_shown = extensions::BraveActionAPI::ShowActionUI(
browser(), brave_rewards_extension_id,
std::make_unique<std::string>("brave_rewards_panel.html#bap-deprecation"),
&error);
EXPECT_TRUE(popup_shown);
}

} // namespace rewards_browsertest

0 comments on commit 4ded398

Please sign in to comment.