OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/content_settings/content_settings_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
10 #include "chrome/browser/content_settings/stub_settings_observer.h" | 10 #include "chrome/browser/content_settings/stub_settings_observer.h" |
11 #include "chrome/browser/prefs/pref_service.h" | 11 #include "chrome/browser/prefs/pref_service.h" |
12 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/pref_names.h" | 13 #include "chrome/common/pref_names.h" |
14 #include "chrome/common/url_constants.h" | 14 #include "chrome/common/url_constants.h" |
| 15 #include "chrome/test/testing_browser_process_test.h" |
15 #include "chrome/test/testing_pref_service.h" | 16 #include "chrome/test/testing_pref_service.h" |
16 #include "chrome/test/testing_profile.h" | 17 #include "chrome/test/testing_profile.h" |
17 #include "googleurl/src/gurl.h" | 18 #include "googleurl/src/gurl.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 | 20 |
20 namespace content_settings { | 21 namespace content_settings { |
21 | 22 |
22 class PrefDefaultProviderTest : public testing::Test { | 23 class PrefDefaultProviderTest : public TestingBrowserProcessTest { |
23 public: | 24 public: |
24 PrefDefaultProviderTest() | 25 PrefDefaultProviderTest() |
25 : ui_thread_(BrowserThread::UI, &message_loop_) { | 26 : ui_thread_(BrowserThread::UI, &message_loop_) { |
26 } | 27 } |
27 | 28 |
28 protected: | 29 protected: |
29 MessageLoop message_loop_; | 30 MessageLoop message_loop_; |
30 BrowserThread ui_thread_; | 31 BrowserThread ui_thread_; |
31 }; | 32 }; |
32 | 33 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 | 130 |
130 bool SettingsEqual(const ContentSettings& settings1, | 131 bool SettingsEqual(const ContentSettings& settings1, |
131 const ContentSettings& settings2) { | 132 const ContentSettings& settings2) { |
132 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 133 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
133 if (settings1.settings[i] != settings2.settings[i]) | 134 if (settings1.settings[i] != settings2.settings[i]) |
134 return false; | 135 return false; |
135 } | 136 } |
136 return true; | 137 return true; |
137 } | 138 } |
138 | 139 |
139 class PrefProviderTest : public testing::Test { | 140 class PrefProviderTest : public TestingBrowserProcessTest { |
140 public: | 141 public: |
141 PrefProviderTest() : ui_thread_( | 142 PrefProviderTest() : ui_thread_( |
142 BrowserThread::UI, &message_loop_) { | 143 BrowserThread::UI, &message_loop_) { |
143 } | 144 } |
144 | 145 |
145 protected: | 146 protected: |
146 MessageLoop message_loop_; | 147 MessageLoop message_loop_; |
147 BrowserThread ui_thread_; | 148 BrowserThread ui_thread_; |
148 }; | 149 }; |
149 | 150 |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 CONTENT_SETTING_BLOCK); | 250 CONTENT_SETTING_BLOCK); |
250 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 251 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
251 pref_content_settings_provider.GetContentSetting( | 252 pref_content_settings_provider.GetContentSetting( |
252 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1)); | 253 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1)); |
253 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 254 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
254 pref_content_settings_provider.GetContentSetting( | 255 pref_content_settings_provider.GetContentSetting( |
255 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource2)); | 256 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource2)); |
256 } | 257 } |
257 | 258 |
258 } // namespace content_settings | 259 } // namespace content_settings |
OLD | NEW |