| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/ui/views/frame/browser_non_client_frame_view.h" | 5 #include "chrome/browser/ui/views/frame/browser_non_client_frame_view.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
| 8 #include "chrome/browser/themes/theme_properties.h" | 8 #include "chrome/browser/themes/theme_properties.h" |
| 9 #include "chrome/browser/ui/views/frame/browser_view.h" | 9 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 10 #include "ui/base/theme_provider.h" | 10 #include "ui/base/theme_provider.h" |
| 11 | 11 |
| 12 using BrowserNonClientFrameViewBrowserTest = ExtensionBrowserTest; | 12 using BrowserNonClientFrameViewBrowserTest = ExtensionBrowserTest; |
| 13 | 13 |
| 14 // Test is Flaky on Windows see crbug.com/600201. |
| 15 #if defined(OS_WIN) |
| 16 #define MAYBE_InactiveSeparatorColor FLAKY_InactiveSeparatorColor |
| 17 #else |
| 18 #define MAYBE_InactiveSeparatorColor InactiveSeparatorColor |
| 19 #endif |
| 20 |
| 14 // Tests that the color returned by | 21 // Tests that the color returned by |
| 15 // BrowserNonClientFrameView::GetToolbarTopSeparatorColor() tracks the window | 22 // BrowserNonClientFrameView::GetToolbarTopSeparatorColor() tracks the window |
| 16 // actiavtion state. | 23 // actiavtion state. |
| 17 IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewBrowserTest, | 24 IN_PROC_BROWSER_TEST_F(BrowserNonClientFrameViewBrowserTest, |
| 18 InactiveSeparatorColor) { | 25 MAYBE_InactiveSeparatorColor) { |
| 19 // In the default theme, the active and inactive separator colors may be the | 26 // In the default theme, the active and inactive separator colors may be the |
| 20 // same. Install a custom theme where they are different. | 27 // same. Install a custom theme where they are different. |
| 21 InstallExtension(test_data_dir_.AppendASCII("theme"), 1); | 28 InstallExtension(test_data_dir_.AppendASCII("theme"), 1); |
| 22 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); | 29 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser()); |
| 23 const BrowserNonClientFrameView* frame_view = | 30 const BrowserNonClientFrameView* frame_view = |
| 24 browser_view->frame()->GetFrameView(); | 31 browser_view->frame()->GetFrameView(); |
| 25 const ui::ThemeProvider* theme_provider = frame_view->GetThemeProvider(); | 32 const ui::ThemeProvider* theme_provider = frame_view->GetThemeProvider(); |
| 26 const SkColor theme_active_color = | 33 const SkColor theme_active_color = |
| 27 theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR); | 34 theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR); |
| 28 const SkColor theme_inactive_color = | 35 const SkColor theme_inactive_color = |
| 29 theme_provider->GetColor( | 36 theme_provider->GetColor( |
| 30 ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE); | 37 ThemeProperties::COLOR_TOOLBAR_TOP_SEPARATOR_INACTIVE); |
| 31 EXPECT_NE(theme_active_color, theme_inactive_color); | 38 EXPECT_NE(theme_active_color, theme_inactive_color); |
| 32 | 39 |
| 33 // Check that the separator color is the active color when the window is | 40 // Check that the separator color is the active color when the window is |
| 34 // active. | 41 // active. |
| 35 browser_view->Activate(); | 42 browser_view->Activate(); |
| 36 EXPECT_TRUE(browser_view->IsActive()); | 43 EXPECT_TRUE(browser_view->IsActive()); |
| 37 const SkColor frame_active_color = frame_view->GetToolbarTopSeparatorColor(); | 44 const SkColor frame_active_color = frame_view->GetToolbarTopSeparatorColor(); |
| 38 EXPECT_EQ(theme_active_color, frame_active_color); | 45 EXPECT_EQ(theme_active_color, frame_active_color); |
| 39 | 46 |
| 40 // Check that the separator color is the inactive color when the window is | 47 // Check that the separator color is the inactive color when the window is |
| 41 // inactive. | 48 // inactive. |
| 42 browser_view->Deactivate(); | 49 browser_view->Deactivate(); |
| 43 EXPECT_FALSE(browser_view->IsActive()); | 50 EXPECT_FALSE(browser_view->IsActive()); |
| 44 const SkColor frame_inactive_color = | 51 const SkColor frame_inactive_color = |
| 45 frame_view->GetToolbarTopSeparatorColor(); | 52 frame_view->GetToolbarTopSeparatorColor(); |
| 46 EXPECT_EQ(theme_inactive_color, frame_inactive_color); | 53 EXPECT_EQ(theme_inactive_color, frame_inactive_color); |
| 47 } | 54 } |
| OLD | NEW |