OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extensions/extension_gcm_app_handler.h" | 5 #include "chrome/browser/extensions/extension_gcm_app_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, true); | 209 profile()->GetPrefs()->SetBoolean(prefs::kGCMChannelEnabled, true); |
210 | 210 |
211 // Create GCMProfileService that talks with fake GCMClient. | 211 // Create GCMProfileService that talks with fake GCMClient. |
212 gcm::GCMProfileService* gcm_profile_service = | 212 gcm::GCMProfileService* gcm_profile_service = |
213 static_cast<gcm::GCMProfileService*>( | 213 static_cast<gcm::GCMProfileService*>( |
214 gcm::GCMProfileServiceFactory::GetInstance()-> | 214 gcm::GCMProfileServiceFactory::GetInstance()-> |
215 SetTestingFactoryAndUse( | 215 SetTestingFactoryAndUse( |
216 profile(), | 216 profile(), |
217 &ExtensionGCMAppHandlerTest::BuildGCMProfileService)); | 217 &ExtensionGCMAppHandlerTest::BuildGCMProfileService)); |
218 scoped_ptr<gcm::GCMClientFactory> gcm_client_factory( | 218 scoped_ptr<gcm::GCMClientFactory> gcm_client_factory( |
219 new gcm::FakeGCMClientFactory(gcm::GCMClientMock::NO_DELAY_LOADING)); | 219 new gcm::FakeGCMClientFactory(gcm::GCMClientMock::NO_DELAY_START)); |
220 gcm_profile_service->Initialize(gcm_client_factory.Pass()); | 220 gcm_profile_service->Initialize(gcm_client_factory.Pass()); |
221 | 221 |
222 // Create a fake version of ExtensionGCMAppHandler. | 222 // Create a fake version of ExtensionGCMAppHandler. |
223 gcm_app_handler_.reset(new FakeExtensionGCMAppHandler(profile(), &waiter_)); | 223 gcm_app_handler_.reset(new FakeExtensionGCMAppHandler(profile(), &waiter_)); |
224 } | 224 } |
225 | 225 |
226 virtual void TearDown() OVERRIDE { | 226 virtual void TearDown() OVERRIDE { |
227 #if defined(OS_CHROMEOS) | 227 #if defined(OS_CHROMEOS) |
228 test_user_manager_.reset(); | 228 test_user_manager_.reset(); |
229 #endif | 229 #endif |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 EXPECT_EQ(gcm::GCMClient::SUCCESS, registration_result()); | 381 EXPECT_EQ(gcm::GCMClient::SUCCESS, registration_result()); |
382 | 382 |
383 // Unregistration should be triggered when the extension is uninstalled. | 383 // Unregistration should be triggered when the extension is uninstalled. |
384 UninstallExtension(extension); | 384 UninstallExtension(extension); |
385 waiter()->WaitUntilCompleted(); | 385 waiter()->WaitUntilCompleted(); |
386 EXPECT_EQ(gcm::GCMClient::SUCCESS, | 386 EXPECT_EQ(gcm::GCMClient::SUCCESS, |
387 gcm_app_handler()->unregistration_result()); | 387 gcm_app_handler()->unregistration_result()); |
388 } | 388 } |
389 | 389 |
390 } // namespace extensions | 390 } // namespace extensions |
OLD | NEW |