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

Side by Side Diff: chrome/browser/ui/gtk/gtk_theme_service_unittest.cc

Issue 7465041: GTTF: Use a fresh TestingBrowserProcess for each test, part #4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: should work Created 9 years, 4 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 6
7 #include "chrome/browser/prefs/pref_service.h" 7 #include "chrome/browser/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 9 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
10 #include "chrome/common/pref_names.h" 10 #include "chrome/common/pref_names.h"
11 #include "chrome/test/testing_browser_process_test.h"
11 #include "chrome/test/testing_profile.h" 12 #include "chrome/test/testing_profile.h"
12 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
13 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
14 15
15 namespace { 16 namespace {
16 17
17 // Converts a GdkColor to a SkColor. 18 // Converts a GdkColor to a SkColor.
18 SkColor GdkToSkColor(GdkColor* color) { 19 SkColor GdkToSkColor(GdkColor* color) {
19 return SkColorSetRGB(color->red >> 8, 20 return SkColorSetRGB(color->red >> 8,
20 color->green >> 8, 21 color->green >> 8,
21 color->blue >> 8); 22 color->blue >> 8);
22 } 23 }
23 24
24 } // namespace 25 } // namespace
25 26
26 class GtkThemeServiceTest : public testing::Test { 27 class GtkThemeServiceTest : public TestingBrowserProcessTest {
27 public: 28 public:
28 GtkThemeServiceTest() : provider_(NULL) {} 29 GtkThemeServiceTest() : provider_(NULL) {}
29 30
30 void SetUseGtkTheme(bool use_gtk_theme) { 31 void SetUseGtkTheme(bool use_gtk_theme) {
31 profile_.GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, use_gtk_theme); 32 profile_.GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, use_gtk_theme);
32 } 33 }
33 34
34 void BuildProvider() { 35 void BuildProvider() {
35 provider_ = GtkThemeService::GetFrom(&profile_); 36 provider_ = GtkThemeService::GetFrom(&profile_);
36 } 37 }
(...skipping 24 matching lines...) Expand all
61 // large, implied global state, it would take some IN_PROCESS_BROWSER_TESTS 62 // large, implied global state, it would take some IN_PROCESS_BROWSER_TESTS
62 // to write an equivalent of DefaultValues above in a way that wouldn't make 63 // to write an equivalent of DefaultValues above in a way that wouldn't make
63 // other tests flaky. kColorTabText is the only simple path where there's no 64 // other tests flaky. kColorTabText is the only simple path where there's no
64 // weird calculations for edge cases so use that as a simple test. 65 // weird calculations for edge cases so use that as a simple test.
65 GtkWidget* fake_label = provider_->fake_label(); 66 GtkWidget* fake_label = provider_->fake_label();
66 GtkStyle* label_style = gtk_rc_get_style(fake_label); 67 GtkStyle* label_style = gtk_rc_get_style(fake_label);
67 GdkColor label_color = label_style->fg[GTK_STATE_NORMAL]; 68 GdkColor label_color = label_style->fg[GTK_STATE_NORMAL];
68 EXPECT_EQ(provider_->GetColor(ThemeService::COLOR_TAB_TEXT), 69 EXPECT_EQ(provider_->GetColor(ThemeService::COLOR_TAB_TEXT),
69 GdkToSkColor(&label_color)); 70 GdkToSkColor(&label_color));
70 } 71 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698