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

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

Issue 23551005: Revert 219709 "Remove the Extensions URLRequestContext." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 3 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) 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 <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/themes/theme_properties.h" 9 #include "chrome/browser/themes/theme_properties.h"
10 #include "chrome/browser/ui/gtk/gtk_theme_service.h" 10 #include "chrome/browser/ui/gtk/gtk_theme_service.h"
11 #include "chrome/common/pref_names.h" 11 #include "chrome/common/pref_names.h"
12 #include "chrome/test/base/testing_profile.h" 12 #include "chrome/test/base/testing_profile.h"
13 #include "content/public/test/test_browser_thread_bundle.h"
14 #include "grit/theme_resources.h" 13 #include "grit/theme_resources.h"
15 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
16 #include "ui/gfx/skia_utils_gtk.h" 15 #include "ui/gfx/skia_utils_gtk.h"
17 16
18 class GtkThemeServiceTest : public testing::Test { 17 class GtkThemeServiceTest : public testing::Test {
19 public: 18 public:
20 GtkThemeServiceTest() : provider_(NULL) {} 19 GtkThemeServiceTest() : provider_(NULL) {}
21 20
22 void SetUseGtkTheme(bool use_gtk_theme) { 21 void SetUseGtkTheme(bool use_gtk_theme) {
23 profile_.GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, use_gtk_theme); 22 profile_.GetPrefs()->SetBoolean(prefs::kUsesSystemTheme, use_gtk_theme);
24 } 23 }
25 24
26 void BuildProvider() { 25 void BuildProvider() {
27 provider_ = GtkThemeService::GetFrom(&profile_); 26 provider_ = GtkThemeService::GetFrom(&profile_);
28 } 27 }
29 28
30 protected: 29 protected:
31 content::TestBrowserThreadBundle thread_bundle_;
32 TestingProfile profile_; 30 TestingProfile profile_;
33 31
34 GtkThemeService* provider_; 32 GtkThemeService* provider_;
35 }; 33 };
36 34
37 TEST_F(GtkThemeServiceTest, DefaultValues) { 35 TEST_F(GtkThemeServiceTest, DefaultValues) {
38 SetUseGtkTheme(false); 36 SetUseGtkTheme(false);
39 BuildProvider(); 37 BuildProvider();
40 38
41 // Test that we get the default theme colors back when in normal mode. 39 // Test that we get the default theme colors back when in normal mode.
(...skipping 12 matching lines...) Expand all
54 // large, implied global state, it would take some IN_PROCESS_BROWSER_TESTS 52 // large, implied global state, it would take some IN_PROCESS_BROWSER_TESTS
55 // to write an equivalent of DefaultValues above in a way that wouldn't make 53 // to write an equivalent of DefaultValues above in a way that wouldn't make
56 // other tests flaky. kColorTabText is the only simple path where there's no 54 // other tests flaky. kColorTabText is the only simple path where there's no
57 // weird calculations for edge cases so use that as a simple test. 55 // weird calculations for edge cases so use that as a simple test.
58 GtkWidget* fake_label = provider_->fake_label(); 56 GtkWidget* fake_label = provider_->fake_label();
59 GtkStyle* label_style = gtk_rc_get_style(fake_label); 57 GtkStyle* label_style = gtk_rc_get_style(fake_label);
60 GdkColor label_color = label_style->fg[GTK_STATE_NORMAL]; 58 GdkColor label_color = label_style->fg[GTK_STATE_NORMAL];
61 EXPECT_EQ(provider_->GetColor(ThemeProperties::COLOR_TAB_TEXT), 59 EXPECT_EQ(provider_->GetColor(ThemeProperties::COLOR_TAB_TEXT),
62 gfx::GdkColorToSkColor(label_color)); 60 gfx::GdkColorToSkColor(label_color));
63 } 61 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698