Skip to content

Commit bac9919

Browse files
committed
presubmit
Signed-off-by: Vadym Struts <vstruts@brave.com>
1 parent ee27762 commit bac9919

2 files changed

Lines changed: 13 additions & 15 deletions

File tree

browser/psst/BUILD.gn

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ static_library("psst") {
2929
"//chrome/browser/profiles",
3030
"//components/content_settings/core/browser",
3131
"//components/permissions",
32+
"//components/infobars/core",
33+
"//chrome/browser/infobars",
34+
"//chrome/browser/ui/webui",
35+
"//components/infobars/content",
36+
"//ui/web_dialogs",
3237
]
3338
}
3439

@@ -70,6 +75,8 @@ source_set("browser_tests") {
7075
"//content/test:test_support",
7176
"//net:test_support",
7277
"//url",
78+
"//brave/browser/psst",
79+
"//components/infobars/content",
7380
]
7481

7582
if (is_android) {

browser/psst/psst_tab_web_contents_observer_browsertest.cc

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,11 @@
99
#include <string>
1010
#include <vector>
1111

12-
#include "base/containers/contains.h"
1312
#include "base/files/file_util.h"
1413
#include "base/path_service.h"
1514
#include "base/run_loop.h"
1615
#include "base/strings/strcat.h"
1716
#include "base/strings/string_number_conversions.h"
18-
#include "base/strings/stringprintf.h"
19-
#include "base/task/task_observer.h"
2017
#include "base/test/bind.h"
2118
#include "base/test/scoped_feature_list.h"
2219
#include "base/time/time.h"
@@ -30,7 +27,6 @@
3027
#include "brave/components/psst/common/pref_names.h"
3128
#include "brave/components/psst/common/psst_metadata_schema.h"
3229
#include "chrome/browser/browser_process.h"
33-
#include "chrome/browser/infobars/test_support/infobar_observer.h"
3430
#include "chrome/browser/profiles/profile.h"
3531
#include "chrome/browser/ui/browser_list.h"
3632
#include "chrome/browser/ui/tabs/tab_strip_model.h"
@@ -40,8 +36,8 @@
4036
#include "components/infobars/content/content_infobar_manager.h"
4137
#include "components/infobars/core/confirm_infobar_delegate.h"
4238
#include "components/infobars/core/infobar.h"
43-
#include "components/web_modal/web_contents_modal_dialog_host.h"
4439
#include "components/web_modal/web_contents_modal_dialog_manager.h"
40+
#include "content/public/browser/visibility.h"
4541
#include "content/public/browser/web_contents.h"
4642
#include "content/public/browser/web_ui.h"
4743
#include "content/public/test/browser_test.h"
@@ -398,14 +394,14 @@ class DialogCloseObserver : public content::WebContentsObserver {
398394
explicit DialogCloseObserver(content::WebContents* web_contents)
399395
: content::WebContentsObserver(web_contents) {}
400396

401-
void WebContentsDestroyed() override { run_loop_.Quit(); }
402-
403-
void Wait() {
404-
if (web_contents()) {
405-
run_loop_.Run();
397+
void OnVisibilityChanged(content::Visibility visibility) override {
398+
if (visibility == content::Visibility::HIDDEN) {
399+
run_loop_.Quit();
406400
}
407401
}
408402

403+
void Wait() { run_loop_.Run(); }
404+
409405
private:
410406
base::RunLoop run_loop_;
411407
};
@@ -483,7 +479,6 @@ class PsstTabWebContentsObserverBrowserTest : public PlatformBrowserTest {
483479
// Ensure all pending tasks are completed before teardown
484480
psst_settings_service_ = nullptr;
485481
profile_ = nullptr;
486-
base::RunLoop().RunUntilIdle();
487482
PlatformBrowserTest::TearDownOnMainThread();
488483
}
489484

@@ -624,9 +619,7 @@ IN_PROC_BROWSER_TEST_F(PsstTabWebContentsObserverBrowserTest,
624619
EXPECT_EQ(confirm_delegate->GetIdentifier(),
625620
infobars::InfoBarDelegate::BRAVE_PSST_INFOBAR_DELEGATE);
626621

627-
base::RunLoop().RunUntilIdle();
628622
confirm_delegate->Accept();
629-
base::RunLoop().RunUntilIdle();
630623

631624
auto* wc = WaitForAndGetDialogWebContents();
632625
ASSERT_TRUE(wc);
@@ -687,9 +680,7 @@ IN_PROC_BROWSER_TEST_F(PsstTabWebContentsObserverBrowserTest,
687680
EXPECT_EQ(confirm_delegate->GetIdentifier(),
688681
infobars::InfoBarDelegate::BRAVE_PSST_INFOBAR_DELEGATE);
689682

690-
base::RunLoop().RunUntilIdle();
691683
confirm_delegate->Accept();
692-
base::RunLoop().RunUntilIdle();
693684

694685
auto* dialog_wc = WaitForAndGetDialogWebContents();
695686
ASSERT_TRUE(dialog_wc);

0 commit comments

Comments
 (0)