OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/profile_resetter/profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
6 | 6 |
7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
11 #include "chrome/browser/extensions/extension_service_unittest.h" | 11 #include "chrome/browser/extensions/extension_service_unittest.h" |
12 #include "chrome/browser/extensions/tab_helper.h" | 12 #include "chrome/browser/extensions/tab_helper.h" |
13 #include "chrome/browser/notifications/desktop_notification_service.h" | 13 #include "chrome/browser/notifications/desktop_notification_service.h" |
14 #include "chrome/browser/notifications/desktop_notification_service_factory.h" | 14 #include "chrome/browser/notifications/desktop_notification_service_factory.h" |
15 #include "chrome/browser/prefs/session_startup_pref.h" | 15 #include "chrome/browser/prefs/session_startup_pref.h" |
16 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" | 16 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
17 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" | 17 #include "chrome/browser/profile_resetter/profile_resetter_test_base.h" |
18 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" | 18 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
19 #include "chrome/browser/search_engines/template_url_service.h" | 19 #include "chrome/browser/search_engines/template_url_service.h" |
20 #include "chrome/browser/search_engines/template_url_service_factory.h" | 20 #include "chrome/browser/search_engines/template_url_service_factory.h" |
21 #include "chrome/browser/themes/theme_service.h" | 21 #include "chrome/browser/themes/theme_service.h" |
22 #include "chrome/browser/themes/theme_service_factory.h" | 22 #include "chrome/browser/themes/theme_service_factory.h" |
23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
24 #include "chrome/common/extensions/extension.h" | 24 #include "chrome/common/extensions/extension.h" |
25 #include "chrome/common/pref_names.h" | 25 #include "chrome/common/pref_names.h" |
26 #include "chrome/test/base/browser_with_test_window_test.h" | 26 #include "chrome/test/base/browser_with_test_window_test.h" |
27 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
28 #include "content/public/test/test_browser_thread.h" | 28 #include "content/public/test/test_browser_thread_bundle.h" |
29 #include "extensions/common/manifest_constants.h" | 29 #include "extensions/common/manifest_constants.h" |
30 #include "net/http/http_response_headers.h" | 30 #include "net/http/http_response_headers.h" |
31 #include "net/url_request/test_url_fetcher_factory.h" | 31 #include "net/url_request/test_url_fetcher_factory.h" |
32 | 32 |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 const char kDistributionConfig[] = "{" | 36 const char kDistributionConfig[] = "{" |
37 " \"homepage\" : \"http://www.foo.com\"," | 37 " \"homepage\" : \"http://www.foo.com\"," |
38 " \"homepage_is_newtabpage\" : false," | 38 " \"homepage_is_newtabpage\" : false," |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 private: | 170 private: |
171 scoped_ptr<net::FakeURLFetcher> CreateFakeURLFetcher( | 171 scoped_ptr<net::FakeURLFetcher> CreateFakeURLFetcher( |
172 const GURL& url, | 172 const GURL& url, |
173 net::URLFetcherDelegate* fetcher_delegate, | 173 net::URLFetcherDelegate* fetcher_delegate, |
174 const std::string& response_data, | 174 const std::string& response_data, |
175 bool success); | 175 bool success); |
176 | 176 |
177 MOCK_METHOD0(Callback, void(void)); | 177 MOCK_METHOD0(Callback, void(void)); |
178 | 178 |
179 base::MessageLoop loop_; | 179 content::TestBrowserThreadBundle thread_bundle_; |
180 content::TestBrowserThread ui_thread_; | |
181 content::TestBrowserThread io_thread_; | |
182 URLFetcherRequestListener request_listener_; | 180 URLFetcherRequestListener request_listener_; |
183 net::FakeURLFetcherFactory factory_; | 181 net::FakeURLFetcherFactory factory_; |
184 }; | 182 }; |
185 | 183 |
186 ConfigParserTest::ConfigParserTest() | 184 ConfigParserTest::ConfigParserTest() |
187 : loop_(base::MessageLoop::TYPE_IO), | 185 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP), |
188 ui_thread_(content::BrowserThread::UI, &loop_), | |
189 io_thread_(content::BrowserThread::IO, &loop_), | |
190 factory_(NULL, base::Bind(&ConfigParserTest::CreateFakeURLFetcher, | 186 factory_(NULL, base::Bind(&ConfigParserTest::CreateFakeURLFetcher, |
191 base::Unretained(this))) { | 187 base::Unretained(this))) { |
192 } | 188 } |
193 | 189 |
194 ConfigParserTest::~ConfigParserTest() {} | 190 ConfigParserTest::~ConfigParserTest() {} |
195 | 191 |
196 scoped_ptr<BrandcodeConfigFetcher> ConfigParserTest::WaitForRequest( | 192 scoped_ptr<BrandcodeConfigFetcher> ConfigParserTest::WaitForRequest( |
197 const GURL& url) { | 193 const GURL& url) { |
198 EXPECT_CALL(*this, Callback()); | 194 EXPECT_CALL(*this, Callback()); |
199 scoped_ptr<BrandcodeConfigFetcher> fetcher( | 195 scoped_ptr<BrandcodeConfigFetcher> fetcher( |
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE_IS_NTP), | 792 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::HOMEPAGE_IS_NTP), |
797 dict->GetBoolean("homepage_is_ntp", &homepage_is_ntp)); | 793 dict->GetBoolean("homepage_is_ntp", &homepage_is_ntp)); |
798 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::DSE_URL), | 794 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::DSE_URL), |
799 dict->GetString("default_search_engine", &default_search_engine)); | 795 dict->GetString("default_search_engine", &default_search_engine)); |
800 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::EXTENSIONS), | 796 EXPECT_EQ(!!(field_mask & ResettableSettingsSnapshot::EXTENSIONS), |
801 dict->GetList("enabled_extensions", &extensions)); | 797 dict->GetList("enabled_extensions", &extensions)); |
802 } | 798 } |
803 } | 799 } |
804 | 800 |
805 } // namespace | 801 } // namespace |
OLD | NEW |