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/chromeos/customization_document.h" | 5 #include "chrome/browser/chromeos/customization_document.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/prefs/testing_pref_service.h" | 8 #include "base/prefs/testing_pref_service.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 | 211 |
212 class ServicesCustomizationDocumentTest : public testing::Test { | 212 class ServicesCustomizationDocumentTest : public testing::Test { |
213 protected: | 213 protected: |
214 ServicesCustomizationDocumentTest() | 214 ServicesCustomizationDocumentTest() |
215 : factory_(NULL, | 215 : factory_(NULL, |
216 base::Bind(&TestURLFetcherCallback::CreateURLFetcher, | 216 base::Bind(&TestURLFetcherCallback::CreateURLFetcher, |
217 base::Unretained(&url_callback_))) { | 217 base::Unretained(&url_callback_))) { |
218 } | 218 } |
219 | 219 |
220 // testing::Test: | 220 // testing::Test: |
221 virtual void SetUp() OVERRIDE { | 221 virtual void SetUp() override { |
222 ServicesCustomizationDocument::InitializeForTesting(); | 222 ServicesCustomizationDocument::InitializeForTesting(); |
223 | 223 |
224 EXPECT_CALL(mock_statistics_provider_, GetMachineStatistic(_, NotNull())) | 224 EXPECT_CALL(mock_statistics_provider_, GetMachineStatistic(_, NotNull())) |
225 .WillRepeatedly(Return(false)); | 225 .WillRepeatedly(Return(false)); |
226 chromeos::system::StatisticsProvider::SetTestProvider( | 226 chromeos::system::StatisticsProvider::SetTestProvider( |
227 &mock_statistics_provider_); | 227 &mock_statistics_provider_); |
228 | 228 |
229 DBusThreadManager::Initialize(); | 229 DBusThreadManager::Initialize(); |
230 NetworkHandler::Initialize(); | 230 NetworkHandler::Initialize(); |
231 RunUntilIdle(); | 231 RunUntilIdle(); |
(...skipping 11 matching lines...) Expand all Loading... |
243 network_portal_detector_.SetDefaultNetworkForTesting(guid); | 243 network_portal_detector_.SetDefaultNetworkForTesting(guid); |
244 if (!guid.empty()) { | 244 if (!guid.empty()) { |
245 network_portal_detector_.SetDetectionResultsForTesting( | 245 network_portal_detector_.SetDetectionResultsForTesting( |
246 guid, online_state); | 246 guid, online_state); |
247 } | 247 } |
248 | 248 |
249 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 249 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
250 ServicesCustomizationDocument::RegisterPrefs(local_state_.registry()); | 250 ServicesCustomizationDocument::RegisterPrefs(local_state_.registry()); |
251 } | 251 } |
252 | 252 |
253 virtual void TearDown() OVERRIDE { | 253 virtual void TearDown() override { |
254 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 254 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
255 NetworkHandler::Shutdown(); | 255 NetworkHandler::Shutdown(); |
256 DBusThreadManager::Shutdown(); | 256 DBusThreadManager::Shutdown(); |
257 NetworkPortalDetector::InitializeForTesting(NULL); | 257 NetworkPortalDetector::InitializeForTesting(NULL); |
258 chromeos::system::StatisticsProvider::SetTestProvider(NULL); | 258 chromeos::system::StatisticsProvider::SetTestProvider(NULL); |
259 | 259 |
260 ServicesCustomizationDocument::ShutdownForTesting(); | 260 ServicesCustomizationDocument::ShutdownForTesting(); |
261 } | 261 } |
262 | 262 |
263 void RunUntilIdle() { | 263 void RunUntilIdle() { |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
476 EXPECT_CALL(visitor, OnExternalExtensionUpdateUrlFound(_, _, _, _, _, _)) | 476 EXPECT_CALL(visitor, OnExternalExtensionUpdateUrlFound(_, _, _, _, _, _)) |
477 .Times(0); | 477 .Times(0); |
478 EXPECT_CALL(visitor, OnExternalProviderReady(_)) | 478 EXPECT_CALL(visitor, OnExternalProviderReady(_)) |
479 .Times(1); | 479 .Times(1); |
480 | 480 |
481 RunUntilIdle(); | 481 RunUntilIdle(); |
482 EXPECT_TRUE(doc->IsReady()); | 482 EXPECT_TRUE(doc->IsReady()); |
483 } | 483 } |
484 | 484 |
485 } // namespace chromeos | 485 } // namespace chromeos |
OLD | NEW |