Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: chrome/browser/themes/theme_service_unittest.cc

Issue 1878973002: [reland] Makes MaterialDesignController initialization explicit (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made it possible to restore MaterialDesignController state after each test case (nits) Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/themes/theme_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 } 395 }
396 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS) 396 #endif // defined(OS_LINUX) && !defined(OS_CHROMEOS)
397 #endif // defined(ENABLE_SUPERVISED_USERS) 397 #endif // defined(ENABLE_SUPERVISED_USERS)
398 398
399 #if !defined(OS_MACOSX) // Mac uses different colors than other platforms. 399 #if !defined(OS_MACOSX) // Mac uses different colors than other platforms.
400 // Simple class to run tests in material design mode. 400 // Simple class to run tests in material design mode.
401 class ThemeServiceMaterialDesignTest : public ThemeServiceTest { 401 class ThemeServiceMaterialDesignTest : public ThemeServiceTest {
402 public: 402 public:
403 void SetUp() override { 403 void SetUp() override {
404 ThemeServiceTest::SetUp(); 404 ThemeServiceTest::SetUp();
405 ui::test::MaterialDesignControllerTestAPI::SetMode( 405 material_design_state_.reset(
406 ui::MaterialDesignController::MATERIAL_NORMAL); 406 new ui::test::MaterialDesignControllerTestAPI(
407 ui::MaterialDesignController::MATERIAL_NORMAL));
407 } 408 }
408 409
409 void TearDown() override { 410 void TearDown() override {
411 material_design_state_.reset();
410 ThemeServiceTest::TearDown(); 412 ThemeServiceTest::TearDown();
411 ui::test::MaterialDesignControllerTestAPI::UninitializeMode();
412 } 413 }
414
415 private:
416 std::unique_ptr<ui::test::MaterialDesignControllerTestAPI>
417 material_design_state_;
413 }; 418 };
414 419
415 // Check that the function which computes the separator color behaves as 420 // Check that the function which computes the separator color behaves as
416 // expected for a variety of inputs. We run in material design mode so we can 421 // expected for a variety of inputs. We run in material design mode so we can
417 // use the material normal and incognito color combinations, which differ from 422 // use the material normal and incognito color combinations, which differ from
418 // each other in ways that are interesting to test. 423 // each other in ways that are interesting to test.
419 TEST_F(ThemeServiceMaterialDesignTest, SeparatorColor) { 424 TEST_F(ThemeServiceMaterialDesignTest, SeparatorColor) {
420 // Ensure Windows 10 machines use the built-in default colors rather than the 425 // Ensure Windows 10 machines use the built-in default colors rather than the
421 // current system native colors. 426 // current system native colors.
422 base::CommandLine::ForCurrentProcess()->AppendSwitch( 427 base::CommandLine::ForCurrentProcess()->AppendSwitch(
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // it should still be lighter than the tab color. 520 // it should still be lighter than the tab color.
516 separator_color = GetSeparatorColor(tab_color, SK_ColorWHITE); 521 separator_color = GetSeparatorColor(tab_color, SK_ColorWHITE);
517 separator_luminance = color_utils::GetRelativeLuminance(separator_color); 522 separator_luminance = color_utils::GetRelativeLuminance(separator_color);
518 EXPECT_LT(separator_luminance, 1); 523 EXPECT_LT(separator_luminance, 1);
519 EXPECT_GT(separator_luminance, tab_luminance); 524 EXPECT_GT(separator_luminance, tab_luminance);
520 } 525 }
521 } 526 }
522 #endif // !defined(OS_MACOSX) 527 #endif // !defined(OS_MACOSX)
523 528
524 }; // namespace theme_service_internal 529 }; // namespace theme_service_internal
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_action_icon_factory_unittest.cc ('k') | chrome/browser/ui/libgtk2ui/gtk2_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698