| 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 16 matching lines...) Expand all Loading... |
| 27 #include "chrome/browser/extensions/extension_service.h" | 27 #include "chrome/browser/extensions/extension_service.h" |
| 28 #include "chrome/browser/extensions/test_extension_service.h" | 28 #include "chrome/browser/extensions/test_extension_service.h" |
| 29 #include "chrome/browser/extensions/test_extension_system.h" | 29 #include "chrome/browser/extensions/test_extension_system.h" |
| 30 #include "chrome/browser/profiles/profile.h" | 30 #include "chrome/browser/profiles/profile.h" |
| 31 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" | 31 #include "chrome/browser/services/gcm/gcm_profile_service_factory.h" |
| 32 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 32 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 33 #include "chrome/browser/signin/signin_manager_factory.h" | 33 #include "chrome/browser/signin/signin_manager_factory.h" |
| 34 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" | 34 #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" |
| 35 #include "chrome/common/channel_info.h" | 35 #include "chrome/common/channel_info.h" |
| 36 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
| 37 #include "chrome/common/chrome_version.h" |
| 37 #include "chrome/test/base/testing_profile.h" | 38 #include "chrome/test/base/testing_profile.h" |
| 38 #include "components/gcm_driver/fake_gcm_app_handler.h" | 39 #include "components/gcm_driver/fake_gcm_app_handler.h" |
| 39 #include "components/gcm_driver/fake_gcm_client.h" | 40 #include "components/gcm_driver/fake_gcm_client.h" |
| 40 #include "components/gcm_driver/fake_gcm_client_factory.h" | 41 #include "components/gcm_driver/fake_gcm_client_factory.h" |
| 41 #include "components/gcm_driver/gcm_client_factory.h" | 42 #include "components/gcm_driver/gcm_client_factory.h" |
| 42 #include "components/gcm_driver/gcm_driver.h" | 43 #include "components/gcm_driver/gcm_driver.h" |
| 43 #include "components/gcm_driver/gcm_profile_service.h" | 44 #include "components/gcm_driver/gcm_profile_service.h" |
| 44 #include "components/keyed_service/core/keyed_service.h" | 45 #include "components/keyed_service/core/keyed_service.h" |
| 45 #include "components/signin/core/browser/signin_manager.h" | 46 #include "components/signin/core/browser/signin_manager.h" |
| 46 #include "content/public/browser/browser_context.h" | 47 #include "content/public/browser/browser_context.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 content::BrowserThread::GetTaskRunnerForThread( | 204 content::BrowserThread::GetTaskRunnerForThread( |
| 204 content::BrowserThread::IO); | 205 content::BrowserThread::IO); |
| 205 base::SequencedWorkerPool* worker_pool = | 206 base::SequencedWorkerPool* worker_pool = |
| 206 content::BrowserThread::GetBlockingPool(); | 207 content::BrowserThread::GetBlockingPool(); |
| 207 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( | 208 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( |
| 208 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( | 209 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( |
| 209 worker_pool->GetSequenceToken(), | 210 worker_pool->GetSequenceToken(), |
| 210 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); | 211 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN)); |
| 211 return base::WrapUnique(new gcm::GCMProfileService( | 212 return base::WrapUnique(new gcm::GCMProfileService( |
| 212 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), | 213 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), |
| 213 chrome::GetChannel(), | 214 PRODUCT_SHORTNAME_STRING, chrome::GetChannel(), |
| 214 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( | 215 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( |
| 215 SigninManagerFactory::GetForProfile(profile), | 216 SigninManagerFactory::GetForProfile(profile), |
| 216 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), | 217 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), |
| 217 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile( | 218 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile( |
| 218 profile))), | 219 profile))), |
| 219 base::WrapUnique(new gcm::FakeGCMClientFactory(ui_thread, io_thread)), | 220 base::WrapUnique(new gcm::FakeGCMClientFactory(ui_thread, io_thread)), |
| 220 ui_thread, io_thread, blocking_task_runner)); | 221 ui_thread, io_thread, blocking_task_runner)); |
| 221 } | 222 } |
| 222 | 223 |
| 223 ExtensionGCMAppHandlerTest() | 224 ExtensionGCMAppHandlerTest() |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 | 486 |
| 486 // App handler is removed when the extension is updated to the version that | 487 // App handler is removed when the extension is updated to the version that |
| 487 // has GCM permission removed. | 488 // has GCM permission removed. |
| 488 UpdateExtension(extension.get(), "good2.crx"); | 489 UpdateExtension(extension.get(), "good2.crx"); |
| 489 waiter()->PumpUILoop(); | 490 waiter()->PumpUILoop(); |
| 490 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); | 491 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); |
| 491 EXPECT_FALSE(HasAppHandlers(extension->id())); | 492 EXPECT_FALSE(HasAppHandlers(extension->id())); |
| 492 } | 493 } |
| 493 | 494 |
| 494 } // namespace extensions | 495 } // namespace extensions |
| OLD | NEW |