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