| 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" |
| 11 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" | 11 #include "chrome/browser/chromeos/net/network_portal_detector_test_impl.h" |
| 12 #include "chrome/browser/extensions/external_provider_impl.h" | 12 #include "chrome/browser/extensions/external_provider_impl.h" |
| 13 #include "chrome/browser/prefs/browser_prefs.h" | 13 #include "chrome/browser/prefs/browser_prefs.h" |
| 14 #include "chrome/browser/prefs/pref_service_mock_factory.h" | 14 #include "chrome/browser/prefs/pref_service_mock_factory.h" |
| 15 #include "chrome/browser/prefs/pref_service_syncable.h" | 15 #include "chrome/browser/prefs/pref_service_syncable.h" |
| 16 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" | 16 #include "chrome/browser/ui/app_list/app_list_syncable_service.h" |
| 17 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" | 17 #include "chrome/browser/ui/app_list/app_list_syncable_service_factory.h" |
| 18 #include "chrome/test/base/testing_browser_process.h" | 18 #include "chrome/test/base/testing_browser_process.h" |
| 19 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
| 20 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
| 21 #include "chromeos/network/network_handler.h" | 21 #include "chromeos/network/network_handler.h" |
| 22 #include "chromeos/network/network_state.h" |
| 23 #include "chromeos/network/network_state_handler.h" |
| 22 #include "chromeos/system/mock_statistics_provider.h" | 24 #include "chromeos/system/mock_statistics_provider.h" |
| 23 #include "components/pref_registry/pref_registry_syncable.h" | 25 #include "components/pref_registry/pref_registry_syncable.h" |
| 24 #include "content/public/test/test_browser_thread_bundle.h" | 26 #include "content/public/test/test_browser_thread_bundle.h" |
| 25 #include "extensions/common/extension.h" | 27 #include "extensions/common/extension.h" |
| 26 #include "extensions/common/manifest.h" | 28 #include "extensions/common/manifest.h" |
| 27 #include "net/http/http_response_headers.h" | 29 #include "net/http/http_response_headers.h" |
| 28 #include "net/http/http_status_code.h" | 30 #include "net/http/http_status_code.h" |
| 29 #include "net/url_request/test_url_fetcher_factory.h" | 31 #include "net/url_request/test_url_fetcher_factory.h" |
| 30 #include "net/url_request/url_request_status.h" | 32 #include "net/url_request/url_request_status.h" |
| 31 #include "testing/gmock/include/gmock/gmock.h" | 33 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 " \"default_apps_folder_name\": \"EN OEM Name\"\n" | 90 " \"default_apps_folder_name\": \"EN OEM Name\"\n" |
| 89 " },\n" | 91 " },\n" |
| 90 " \"default\": {\n" | 92 " \"default\": {\n" |
| 91 " \"default_apps_folder_name\": \"Default OEM Name\"\n" | 93 " \"default_apps_folder_name\": \"Default OEM Name\"\n" |
| 92 " }\n" | 94 " }\n" |
| 93 " }\n" | 95 " }\n" |
| 94 "}"; | 96 "}"; |
| 95 | 97 |
| 96 const char kDummyCustomizationID[] = "test-dummy"; | 98 const char kDummyCustomizationID[] = "test-dummy"; |
| 97 | 99 |
| 98 // Note the path name must be the same as in shill stub. | |
| 99 const char kStubEthernetServicePath[] = "eth1"; | |
| 100 | |
| 101 } // anonymous namespace | 100 } // anonymous namespace |
| 102 | 101 |
| 103 namespace chromeos { | 102 namespace chromeos { |
| 104 | 103 |
| 105 using ::testing::_; | 104 using ::testing::_; |
| 106 using ::testing::DoAll; | 105 using ::testing::DoAll; |
| 107 using ::testing::NotNull; | 106 using ::testing::NotNull; |
| 108 using ::testing::Return; | 107 using ::testing::Return; |
| 109 using ::testing::SetArgumentPointee; | 108 using ::testing::SetArgumentPointee; |
| 110 | 109 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 virtual void SetUp() OVERRIDE { | 221 virtual void SetUp() OVERRIDE { |
| 223 ServicesCustomizationDocument::InitializeForTesting(); | 222 ServicesCustomizationDocument::InitializeForTesting(); |
| 224 | 223 |
| 225 EXPECT_CALL(mock_statistics_provider_, GetMachineStatistic(_, NotNull())) | 224 EXPECT_CALL(mock_statistics_provider_, GetMachineStatistic(_, NotNull())) |
| 226 .WillRepeatedly(Return(false)); | 225 .WillRepeatedly(Return(false)); |
| 227 chromeos::system::StatisticsProvider::SetTestProvider( | 226 chromeos::system::StatisticsProvider::SetTestProvider( |
| 228 &mock_statistics_provider_); | 227 &mock_statistics_provider_); |
| 229 | 228 |
| 230 DBusThreadManager::InitializeWithStub(); | 229 DBusThreadManager::InitializeWithStub(); |
| 231 NetworkHandler::Initialize(); | 230 NetworkHandler::Initialize(); |
| 231 RunUntilIdle(); |
| 232 std::string default_network_path = |
| 233 NetworkHandler::Get()->network_state_handler()->default_network_path(); |
| 232 | 234 |
| 233 NetworkPortalDetector::InitializeForTesting(&network_portal_detector_); | 235 NetworkPortalDetector::InitializeForTesting(&network_portal_detector_); |
| 234 NetworkPortalDetector::CaptivePortalState online_state; | 236 NetworkPortalDetector::CaptivePortalState online_state; |
| 235 online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; | 237 online_state.status = NetworkPortalDetector::CAPTIVE_PORTAL_STATUS_ONLINE; |
| 236 online_state.response_code = 204; | 238 online_state.response_code = 204; |
| 237 network_portal_detector_.SetDefaultNetworkPathForTesting( | 239 network_portal_detector_.SetDefaultNetworkPathForTesting( |
| 238 kStubEthernetServicePath); | 240 default_network_path); |
| 239 network_portal_detector_.SetDetectionResultsForTesting( | 241 network_portal_detector_.SetDetectionResultsForTesting( |
| 240 kStubEthernetServicePath, online_state); | 242 default_network_path, online_state); |
| 241 | 243 |
| 242 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); | 244 TestingBrowserProcess::GetGlobal()->SetLocalState(&local_state_); |
| 243 ServicesCustomizationDocument::RegisterPrefs(local_state_.registry()); | 245 ServicesCustomizationDocument::RegisterPrefs(local_state_.registry()); |
| 244 } | 246 } |
| 245 | 247 |
| 246 virtual void TearDown() OVERRIDE { | 248 virtual void TearDown() OVERRIDE { |
| 247 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); | 249 TestingBrowserProcess::GetGlobal()->SetLocalState(NULL); |
| 248 NetworkHandler::Shutdown(); | 250 NetworkHandler::Shutdown(); |
| 249 DBusThreadManager::Shutdown(); | 251 DBusThreadManager::Shutdown(); |
| 250 NetworkPortalDetector::InitializeForTesting(NULL); | 252 NetworkPortalDetector::InitializeForTesting(NULL); |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 EXPECT_CALL(visitor, OnExternalExtensionUpdateUrlFound(_, _, _, _, _, _)) | 471 EXPECT_CALL(visitor, OnExternalExtensionUpdateUrlFound(_, _, _, _, _, _)) |
| 470 .Times(0); | 472 .Times(0); |
| 471 EXPECT_CALL(visitor, OnExternalProviderReady(_)) | 473 EXPECT_CALL(visitor, OnExternalProviderReady(_)) |
| 472 .Times(1); | 474 .Times(1); |
| 473 | 475 |
| 474 RunUntilIdle(); | 476 RunUntilIdle(); |
| 475 EXPECT_TRUE(doc->IsReady()); | 477 EXPECT_TRUE(doc->IsReady()); |
| 476 } | 478 } |
| 477 | 479 |
| 478 } // namespace chromeos | 480 } // namespace chromeos |
| OLD | NEW |