| 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 <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 content::BrowserThread::UI); | 202 content::BrowserThread::UI); |
| 203 scoped_refptr<base::SequencedTaskRunner> io_thread = | 203 scoped_refptr<base::SequencedTaskRunner> io_thread = |
| 204 content::BrowserThread::GetTaskRunnerForThread( | 204 content::BrowserThread::GetTaskRunnerForThread( |
| 205 content::BrowserThread::IO); | 205 content::BrowserThread::IO); |
| 206 base::SequencedWorkerPool* worker_pool = | 206 base::SequencedWorkerPool* worker_pool = |
| 207 content::BrowserThread::GetBlockingPool(); | 207 content::BrowserThread::GetBlockingPool(); |
| 208 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( | 208 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( |
| 209 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 209 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| 210 worker_pool->GetSequenceToken(), | 210 worker_pool->GetSequenceToken(), |
| 211 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 211 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 212 return base::WrapUnique(new gcm::GCMProfileService( | 212 return base::MakeUnique<gcm::GCMProfileService>( |
| 213 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), | 213 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), |
| 214 chrome::GetChannel(), | 214 chrome::GetChannel(), |
| 215 gcm::GetProductCategoryForSubtypes(profile->GetPrefs()), | 215 gcm::GetProductCategoryForSubtypes(profile->GetPrefs()), |
| 216 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( | 216 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( |
| 217 SigninManagerFactory::GetForProfile(profile), | 217 SigninManagerFactory::GetForProfile(profile), |
| 218 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 218 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 219 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile( | 219 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile( |
| 220 profile))), | 220 profile))), |
| 221 base::WrapUnique(new gcm::FakeGCMClientFactory(ui_thread, io_thread)), | 221 base::WrapUnique(new gcm::FakeGCMClientFactory(ui_thread, io_thread)), |
| 222 ui_thread, io_thread, blocking_task_runner)); | 222 ui_thread, io_thread, blocking_task_runner); |
| 223 } | 223 } |
| 224 | 224 |
| 225 ExtensionGCMAppHandlerTest() | 225 ExtensionGCMAppHandlerTest() |
| 226 : extension_service_(NULL), | 226 : extension_service_(NULL), |
| 227 registration_result_(gcm::GCMClient::UNKNOWN_ERROR), | 227 registration_result_(gcm::GCMClient::UNKNOWN_ERROR), |
| 228 unregistration_result_(gcm::GCMClient::UNKNOWN_ERROR) { | 228 unregistration_result_(gcm::GCMClient::UNKNOWN_ERROR) { |
| 229 } | 229 } |
| 230 | 230 |
| 231 ~ExtensionGCMAppHandlerTest() override {} | 231 ~ExtensionGCMAppHandlerTest() override {} |
| 232 | 232 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 | 487 |
| 488 // App handler is removed when the extension is updated to the version that | 488 // App handler is removed when the extension is updated to the version that |
| 489 // has GCM permission removed. | 489 // has GCM permission removed. |
| 490 UpdateExtension(extension.get(), "good2.crx"); | 490 UpdateExtension(extension.get(), "good2.crx"); |
| 491 waiter()->PumpUILoop(); | 491 waiter()->PumpUILoop(); |
| 492 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); | 492 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); |
| 493 EXPECT_FALSE(HasAppHandlers(extension->id())); | 493 EXPECT_FALSE(HasAppHandlers(extension->id())); |
| 494 } | 494 } |
| 495 | 495 |
| 496 } // namespace extensions | 496 } // namespace extensions |
| OLD | NEW |