Skip to content

Commit

Permalink
Fix browser test overrides
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed Nov 9, 2023
1 parent 886954a commit 3bd303c
Show file tree
Hide file tree
Showing 34 changed files with 202 additions and 392 deletions.
4 changes: 1 addition & 3 deletions android/android_browser_tests.gni
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ android_test_exception_sources = [
"//brave/browser/extensions/brave_extension_functional_test.h",
"//brave/browser/extensions/brave_extension_provider_browsertest.cc",
"//brave/browser/extensions/brave_theme_event_router_browsertest.cc",
"//brave/browser/extensions/extension_urls_browsertest.cc",
"//brave/browser/favicon/favicon_database_browsertest.cc",
"//brave/browser/perf/brave_perf_features_processor_browsertest.cc",
"//brave/browser/policy/brave_policy_browsertest.cc",
Expand Down Expand Up @@ -113,7 +112,6 @@ android_test_exception_deps = [
"//brave/browser/farbling:browser_tests",
"//brave/browser/net:browser_tests",
"//brave/browser/permissions:browser_tests",
"//brave/browser/playlist/test:browser_tests",
"//brave/browser/psst:browser_tests",
"//brave/browser/test:browser_tests",
"//brave/browser/ui:browser_tests",
Expand Down Expand Up @@ -144,6 +142,7 @@ android_only_test_deps = [
"//brave/browser/partnercustomizations:delegate_public_impl_java",
"//brave/components/brave_wallet/browser:test_support",
"//brave/components/cosmetic_filters/browser:browser",
"//brave/third_party/android_deps:com_android_installreferrer_java",
"//chrome:chrome_android_core",
"//chrome/android:app_hooks_java",
"//chrome/android:delegate_public_impl_java",
Expand All @@ -153,7 +152,6 @@ android_only_test_deps = [
"//chrome/browser/metrics:test_support",
"//chrome/test:android_browsertests_assets",
"//chrome/test:android_browsertests_java",
"//chrome/test:browser_tests_runner",
"//chrome/test:test_support",
"//chrome/test:test_support_ui_android",
"//components/browser_ui/widget/android:java",
Expand Down
14 changes: 0 additions & 14 deletions browser/autoplay/autoplay_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/test/thread_test_helper.h"
#include "brave/browser/brave_content_browser_client.h"
#include "brave/components/constants/brave_paths.h"
#include "brave/components/constants/pref_names.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/content_settings/core/browser/host_content_settings_map.h"
Expand All @@ -37,11 +35,6 @@ class AutoplayBrowserTest : public InProcessBrowserTest {
void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();

content_client_ = std::make_unique<ChromeContentClient>();
content::SetContentClient(content_client_.get());
browser_content_client_ = std::make_unique<BraveContentBrowserClient>();
content::SetBrowserClientForTesting(browser_content_client_.get());

host_resolver()->AddRule("*", "127.0.0.1");
content::SetupCrossSiteRedirector(embedded_test_server());

Expand All @@ -63,11 +56,6 @@ class AutoplayBrowserTest : public InProcessBrowserTest {
ContentSettingsPattern::FromString(index_url_.spec());
}

void TearDown() override {
browser_content_client_.reset();
content_client_.reset();
}

const GURL& index_url() { return index_url_; }
const GURL& file_autoplay_method_url() { return file_autoplay_method_url_; }
const GURL& file_autoplay_attr_url() { return file_autoplay_attr_url_; }
Expand Down Expand Up @@ -130,8 +118,6 @@ class AutoplayBrowserTest : public InProcessBrowserTest {
GURL file_autoplay_method_url_;
GURL file_autoplay_attr_url_;
ContentSettingsPattern top_level_page_pattern_;
std::unique_ptr<ChromeContentClient> content_client_;
std::unique_ptr<BraveContentBrowserClient> browser_content_client_;
};

IN_PROC_BROWSER_TEST_F(AutoplayBrowserTest, AllowAutoplay) {
Expand Down
10 changes: 2 additions & 8 deletions browser/brave_content_browser_client_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_window.h"
#include "chrome/common/buildflags.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/common/webui_url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
Expand All @@ -33,6 +32,7 @@
#include "components/omnibox/browser/location_bar_model.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/navigation_entry.h"
#include "content/public/common/content_client.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_navigation_observer.h"
Expand Down Expand Up @@ -65,8 +65,6 @@ class BraveContentBrowserClientTest : public InProcessBrowserTest {
void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();

content_client_ = std::make_unique<ChromeContentClient>();
content::SetContentClient(content_client_.get());
browser_content_client_ = std::make_unique<BraveContentBrowserClient>();
content::SetBrowserClientForTesting(browser_content_client_.get());

Expand Down Expand Up @@ -113,10 +111,7 @@ class BraveContentBrowserClientTest : public InProcessBrowserTest {
"brave_webtorrent.html?chrome://settings");
}

void TearDown() override {
browser_content_client_.reset();
content_client_.reset();
}
void TearDown() override { browser_content_client_.reset(); }

const GURL& magnet_html_url() { return magnet_html_url_; }
const GURL& magnet_url() { return magnet_url_; }
Expand All @@ -138,7 +133,6 @@ class BraveContentBrowserClientTest : public InProcessBrowserTest {
GURL torrent_url_;
GURL torrent_extension_url_;
GURL torrent_invalid_query_extension_url_;
std::unique_ptr<ChromeContentClient> content_client_;
std::unique_ptr<BraveContentBrowserClient> browser_content_client_;
};

Expand Down
4 changes: 0 additions & 4 deletions browser/brave_shields/https_upgrade_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

#include "base/test/scoped_feature_list.h"
#include "brave/browser/brave_browser_process.h"
#include "brave/browser/brave_content_browser_client.h"
#include "brave/components/brave_shields/browser/brave_shields_util.h"
#include "brave/components/https_upgrade_exceptions/browser/https_upgrade_exceptions_service.h"
#include "chrome/browser/browser_process.h"
Expand All @@ -17,7 +16,6 @@
#include "chrome/common/pref_names.h"
#include "chrome/test/base/chrome_test_utils.h"
#include "components/prefs/pref_service.h"
#include "content/public/common/content_client.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/content_mock_cert_verifier.h"
Expand Down Expand Up @@ -105,7 +103,6 @@ class HttpsUpgradeBrowserTest : public PlatformBrowserTest {

void SetUpOnMainThread() override {
PlatformBrowserTest::SetUpOnMainThread();
content::SetBrowserClientForTesting(&client_);
g_brave_browser_process->https_upgrade_exceptions_service()
->SetIsReadyForTesting();
// By default allow all hosts on HTTPS.
Expand Down Expand Up @@ -208,7 +205,6 @@ class HttpsUpgradeBrowserTest : public PlatformBrowserTest {
net::EmbeddedTestServer http_server_{net::EmbeddedTestServer::TYPE_HTTP};
net::EmbeddedTestServer https_server_{net::EmbeddedTestServer::TYPE_HTTPS};
content::ContentMockCertVerifier mock_cert_verifier_;
BraveContentBrowserClient client_;
};

class HttpsUpgradeBrowserTest_FlagDisabled : public HttpsUpgradeBrowserTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
#include "brave/components/constants/pref_names.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/common/content_client.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "net/dns/mock_host_resolver.h"
Expand Down
15 changes: 0 additions & 15 deletions browser/farbling/brave_enumeratedevices_farbling_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/test/thread_test_helper.h"
#include "brave/browser/brave_content_browser_client.h"
#include "brave/browser/extensions/brave_base_local_data_files_browsertest.h"
#include "brave/components/brave_component_updater/browser/local_data_files_service.h"
#include "brave/components/brave_shields/browser/brave_shields_util.h"
Expand All @@ -17,7 +16,6 @@
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/network_session_configurator/common/network_switches.h"
Expand Down Expand Up @@ -64,20 +62,9 @@ class BraveEnumerateDevicesFarblingBrowserTest : public InProcessBrowserTest {

void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();

content_client_ = std::make_unique<ChromeContentClient>();
content::SetContentClient(content_client_.get());
browser_content_client_ = std::make_unique<BraveContentBrowserClient>();
content::SetBrowserClientForTesting(browser_content_client_.get());

host_resolver()->AddRule("*", "127.0.0.1");
}

void TearDown() override {
browser_content_client_.reset();
content_client_.reset();
}

protected:
base::test::ScopedFeatureList feature_list_;
net::EmbeddedTestServer https_server_;
Expand Down Expand Up @@ -110,8 +97,6 @@ class BraveEnumerateDevicesFarblingBrowserTest : public InProcessBrowserTest {
private:
GURL top_level_page_url_;
GURL farbling_url_;
std::unique_ptr<ChromeContentClient> content_client_;
std::unique_ptr<BraveContentBrowserClient> browser_content_client_;
};

// Tests results of farbling known values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#include "base/path_service.h"
#include "base/strings/stringprintf.h"
#include "base/test/thread_test_helper.h"
#include "brave/browser/brave_content_browser_client.h"
#include "brave/browser/extensions/brave_base_local_data_files_browsertest.h"
#include "brave/components/brave_component_updater/browser/local_data_files_service.h"
#include "brave/components/brave_shields/browser/brave_shields_util.h"
Expand All @@ -17,7 +16,6 @@
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/network_session_configurator/common/network_switches.h"
Expand Down Expand Up @@ -54,20 +52,9 @@ class BraveDeviceMemoryFarblingBrowserTest : public InProcessBrowserTest {

void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();

content_client_ = std::make_unique<ChromeContentClient>();
content::SetContentClient(content_client_.get());
browser_content_client_ = std::make_unique<BraveContentBrowserClient>();
content::SetBrowserClientForTesting(browser_content_client_.get());

host_resolver()->AddRule("*", "127.0.0.1");
}

void TearDown() override {
browser_content_client_.reset();
content_client_.reset();
}

protected:
base::test::ScopedFeatureList feature_list_;
net::EmbeddedTestServer https_server_;
Expand Down Expand Up @@ -97,10 +84,6 @@ class BraveDeviceMemoryFarblingBrowserTest : public InProcessBrowserTest {
content::WebContents* contents() {
return browser()->tab_strip_model()->GetActiveWebContents();
}

private:
std::unique_ptr<ChromeContentClient> content_client_;
std::unique_ptr<BraveContentBrowserClient> browser_content_client_;
};

// Tests results of farbling known values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/test/thread_test_helper.h"
#include "brave/browser/brave_content_browser_client.h"
#include "brave/browser/extensions/brave_base_local_data_files_browsertest.h"
#include "brave/components/brave_component_updater/browser/local_data_files_service.h"
#include "brave/components/brave_shields/browser/brave_shields_util.h"
Expand All @@ -18,7 +17,6 @@
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/permissions/permission_request.h"
Expand All @@ -39,11 +37,6 @@ class BraveNavigatorHardwareConcurrencyFarblingBrowserTest
void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();

content_client_ = std::make_unique<ChromeContentClient>();
content::SetContentClient(content_client_.get());
browser_content_client_ = std::make_unique<BraveContentBrowserClient>();
content::SetBrowserClientForTesting(browser_content_client_.get());

host_resolver()->AddRule("*", "127.0.0.1");
content::SetupCrossSiteRedirector(embedded_test_server());

Expand All @@ -58,11 +51,6 @@ class BraveNavigatorHardwareConcurrencyFarblingBrowserTest
farbling_url_ = embedded_test_server()->GetURL("a.com", "/simple.html");
}

void TearDown() override {
browser_content_client_.reset();
content_client_.reset();
}

const GURL& farbling_url() { return farbling_url_; }

HostContentSettingsMap* content_settings() {
Expand Down Expand Up @@ -91,8 +79,6 @@ class BraveNavigatorHardwareConcurrencyFarblingBrowserTest
private:
GURL top_level_page_url_;
GURL farbling_url_;
std::unique_ptr<ChromeContentClient> content_client_;
std::unique_ptr<BraveContentBrowserClient> browser_content_client_;
};

// Tests results of farbling known values
Expand Down
15 changes: 0 additions & 15 deletions browser/farbling/brave_navigator_keyboard_api_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,11 @@

#include "base/containers/contains.h"
#include "base/path_service.h"
#include "brave/browser/brave_content_browser_client.h"
#include "brave/components/brave_shields/browser/brave_shields_util.h"
#include "brave/components/constants/brave_paths.h"
#include "chrome/browser/content_settings/host_content_settings_map_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_content_client.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/test/browser_test.h"
Expand Down Expand Up @@ -53,20 +51,9 @@ class BraveNavigatorKeyboardAPIBrowserTest : public InProcessBrowserTest {

void SetUpOnMainThread() override {
InProcessBrowserTest::SetUpOnMainThread();

content_client_ = std::make_unique<ChromeContentClient>();
content::SetContentClient(content_client_.get());
browser_content_client_ = std::make_unique<BraveContentBrowserClient>();
content::SetBrowserClientForTesting(browser_content_client_.get());

host_resolver()->AddRule("*", "127.0.0.1");
}

void TearDown() override {
browser_content_client_.reset();
content_client_.reset();
}

protected:
net::EmbeddedTestServer https_server_;

Expand Down Expand Up @@ -98,8 +85,6 @@ class BraveNavigatorKeyboardAPIBrowserTest : public InProcessBrowserTest {
private:
GURL top_level_page_url_;
GURL test_url_;
std::unique_ptr<ChromeContentClient> content_client_;
std::unique_ptr<BraveContentBrowserClient> browser_content_client_;
};

IN_PROC_BROWSER_TEST_F(BraveNavigatorKeyboardAPIBrowserTest,
Expand Down
Loading

0 comments on commit 3bd303c

Please sign in to comment.