Skip to content

Commit

Permalink
Merge pull request #2202 from brave/run_dark_mode_test_only_mojave
Browse files Browse the repository at this point in the history
Run dark mode test only on mojave
  • Loading branch information
simonhong authored Apr 17, 2019
2 parents 1de5e4c + b4483e8 commit 3661c1f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,23 +27,25 @@ void SetBraveThemeType(Profile* profile, BraveThemeType type) {
// Test whether DarkModeObserver observes proper NativeTheme.
IN_PROC_BROWSER_TEST_F(BraveDarkModeObserverTest,
ObserveProperNativeThemeTest) {
base::test::ScopedFeatureList features;
features.InitAndEnableFeature(features::kWebUIDarkMode);

Profile* profile = browser()->profile();

// Load webui to instantiate BraveDarkModeObserver.
AddTabAtIndexToBrowser(
browser(), 0, GURL("brave://history"), ui::PAGE_TRANSITION_TYPED, true);

// Initially set to light.
SetBraveThemeType(profile, BraveThemeType::BRAVE_THEME_TYPE_LIGHT);
EXPECT_EQ(
ui::NativeTheme::GetInstanceForNativeUi(),
BraveDarkModeObserver::current_native_theme_for_testing_);

SetBraveThemeType(profile, BraveThemeType::BRAVE_THEME_TYPE_DARK);
EXPECT_EQ(
ui::NativeThemeDarkAura::instance(),
BraveDarkModeObserver::current_native_theme_for_testing_);
if (@available(macOS 10.14, *)) {
base::test::ScopedFeatureList features;
features.InitAndEnableFeature(features::kWebUIDarkMode);

Profile* profile = browser()->profile();

// Load webui to instantiate BraveDarkModeObserver.
AddTabAtIndexToBrowser(
browser(), 0, GURL("brave://history"), ui::PAGE_TRANSITION_TYPED, true);

// Initially set to light.
SetBraveThemeType(profile, BraveThemeType::BRAVE_THEME_TYPE_LIGHT);
EXPECT_EQ(
ui::NativeTheme::GetInstanceForNativeUi(),
BraveDarkModeObserver::current_native_theme_for_testing_);

SetBraveThemeType(profile, BraveThemeType::BRAVE_THEME_TYPE_DARK);
EXPECT_EQ(
ui::NativeThemeDarkAura::instance(),
BraveDarkModeObserver::current_native_theme_for_testing_);
}
}
2 changes: 1 addition & 1 deletion test/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ test("brave_browser_tests") {
"//brave/browser/renderer_context_menu/brave_mock_render_view_context_menu.h",
"//brave/browser/renderer_context_menu/brave_spelling_menu_observer_browsertest.cc",
"//brave/browser/search_engines/search_engine_provider_service_browsertest.cc",
"//brave/browser/ui/brave_dark_mode_observer_browsertest_mac.cc",
"//brave/browser/ui/brave_dark_mode_observer_browsertest_mac.mm",
"//brave/browser/ui/content_settings/brave_autoplay_blocked_image_model_browsertest.cc",
"//brave/browser/ui/views/brave_actions/brave_actions_container_browsertest.cc",
"//brave/browser/ui/views/profiles/brave_profile_chooser_view_browsertest.cc",
Expand Down

0 comments on commit 3661c1f

Please sign in to comment.