OLD | NEW |
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 "chrome/browser/content_settings/content_settings_policy_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_policy_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
11 #include "chrome/browser/content_settings/content_settings_mock_observer.h" | 11 #include "chrome/browser/content_settings/content_settings_mock_observer.h" |
12 #include "chrome/browser/prefs/pref_service.h" | 12 #include "chrome/browser/prefs/pref_service.h" |
13 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
14 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
16 #include "chrome/test/base/testing_browser_process_test.h" | |
17 #include "chrome/test/base/testing_pref_service.h" | 16 #include "chrome/test/base/testing_pref_service.h" |
18 #include "chrome/test/base/testing_profile.h" | 17 #include "chrome/test/base/testing_profile.h" |
19 #include "content/browser/browser_thread.h" | 18 #include "content/browser/browser_thread.h" |
20 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
21 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
22 | 21 |
23 using ::testing::_; | 22 using ::testing::_; |
24 | 23 |
25 namespace content_settings { | 24 namespace content_settings { |
26 | 25 |
27 class PolicyDefaultProviderTest : public TestingBrowserProcessTest { | 26 class PolicyDefaultProviderTest : public testing::Test { |
28 public: | 27 public: |
29 PolicyDefaultProviderTest() | 28 PolicyDefaultProviderTest() |
30 : ui_thread_(BrowserThread::UI, &message_loop_) { | 29 : ui_thread_(BrowserThread::UI, &message_loop_) { |
31 } | 30 } |
32 | 31 |
33 protected: | 32 protected: |
34 MessageLoop message_loop_; | 33 MessageLoop message_loop_; |
35 BrowserThread ui_thread_; | 34 BrowserThread ui_thread_; |
36 }; | 35 }; |
37 | 36 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 TestingPrefService* prefs = profile.GetTestingPrefService(); | 133 TestingPrefService* prefs = profile.GetTestingPrefService(); |
135 PolicyDefaultProvider provider(prefs); | 134 PolicyDefaultProvider provider(prefs); |
136 | 135 |
137 EXPECT_EQ(CONTENT_SETTING_ASK, | 136 EXPECT_EQ(CONTENT_SETTING_ASK, |
138 provider.ProvideDefaultSetting( | 137 provider.ProvideDefaultSetting( |
139 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE)); | 138 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE)); |
140 | 139 |
141 provider.ShutdownOnUIThread(); | 140 provider.ShutdownOnUIThread(); |
142 } | 141 } |
143 | 142 |
144 class PolicyProviderTest : public TestingBrowserProcessTest { | 143 class PolicyProviderTest : public testing::Test { |
145 public: | 144 public: |
146 PolicyProviderTest() | 145 PolicyProviderTest() |
147 : ui_thread_(BrowserThread::UI, &message_loop_) { | 146 : ui_thread_(BrowserThread::UI, &message_loop_) { |
148 } | 147 } |
149 | 148 |
150 protected: | 149 protected: |
151 // TODO(markusheintz): Check if it's possible to derive the provider class | 150 // TODO(markusheintz): Check if it's possible to derive the provider class |
152 // from NonThreadSafe and to use native thread identifiers instead of | 151 // from NonThreadSafe and to use native thread identifiers instead of |
153 // BrowserThread IDs. Then we could get rid of the message_loop and ui_thread | 152 // BrowserThread IDs. Then we could get rid of the message_loop and ui_thread |
154 // fields. | 153 // fields. |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 266 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
268 provider.GetContentSetting( | 267 provider.GetContentSetting( |
269 google_url, | 268 google_url, |
270 google_url, | 269 google_url, |
271 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 270 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
272 std::string())); | 271 std::string())); |
273 | 272 |
274 provider.ShutdownOnUIThread(); | 273 provider.ShutdownOnUIThread(); |
275 } | 274 } |
276 } // namespace content_settings | 275 } // namespace content_settings |
OLD | NEW |