Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: chrome/browser/extensions/extension_gcm_app_handler_unittest.cc

Issue 2879923002: Use TaskScheduler instead of SequencedWorkerPool in extension_gcm_app_handler_unittest.cc. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h" 12 #include "base/bind_helpers.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/files/scoped_temp_dir.h" 16 #include "base/files/scoped_temp_dir.h"
17 #include "base/location.h" 17 #include "base/location.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/macros.h" 19 #include "base/macros.h"
20 #include "base/memory/ptr_util.h" 20 #include "base/memory/ptr_util.h"
21 #include "base/memory/ref_counted.h" 21 #include "base/memory/ref_counted.h"
22 #include "base/path_service.h" 22 #include "base/path_service.h"
23 #include "base/run_loop.h" 23 #include "base/run_loop.h"
24 #include "base/threading/sequenced_worker_pool.h" 24 #include "base/task_scheduler/post_task.h"
25 #include "base/values.h" 25 #include "base/values.h"
26 #include "build/build_config.h" 26 #include "build/build_config.h"
27 #include "chrome/browser/chrome_notification_types.h" 27 #include "chrome/browser/chrome_notification_types.h"
28 #include "chrome/browser/extensions/api/gcm/gcm_api.h" 28 #include "chrome/browser/extensions/api/gcm/gcm_api.h"
29 #include "chrome/browser/extensions/extension_service.h" 29 #include "chrome/browser/extensions/extension_service.h"
30 #include "chrome/browser/extensions/test_extension_service.h" 30 #include "chrome/browser/extensions/test_extension_service.h"
31 #include "chrome/browser/extensions/test_extension_system.h" 31 #include "chrome/browser/extensions/test_extension_system.h"
32 #include "chrome/browser/gcm/gcm_product_util.h" 32 #include "chrome/browser/gcm/gcm_product_util.h"
33 #include "chrome/browser/gcm/gcm_profile_service_factory.h" 33 #include "chrome/browser/gcm/gcm_profile_service_factory.h"
34 #include "chrome/browser/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 public: 195 public:
196 static std::unique_ptr<KeyedService> BuildGCMProfileService( 196 static std::unique_ptr<KeyedService> BuildGCMProfileService(
197 content::BrowserContext* context) { 197 content::BrowserContext* context) {
198 Profile* profile = Profile::FromBrowserContext(context); 198 Profile* profile = Profile::FromBrowserContext(context);
199 scoped_refptr<base::SequencedTaskRunner> ui_thread = 199 scoped_refptr<base::SequencedTaskRunner> ui_thread =
200 content::BrowserThread::GetTaskRunnerForThread( 200 content::BrowserThread::GetTaskRunnerForThread(
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 =
206 content::BrowserThread::GetBlockingPool();
207 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner( 205 scoped_refptr<base::SequencedTaskRunner> blocking_task_runner(
208 worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( 206 base::CreateSequencedTaskRunnerWithTraits(
209 worker_pool->GetSequenceToken(), 207 {base::MayBlock(), base::TaskShutdownBehavior::SKIP_ON_SHUTDOWN}));
210 base::SequencedWorkerPool::SKIP_ON_SHUTDOWN));
211 return base::MakeUnique<gcm::GCMProfileService>( 208 return base::MakeUnique<gcm::GCMProfileService>(
212 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(), 209 profile->GetPrefs(), profile->GetPath(), profile->GetRequestContext(),
213 chrome::GetChannel(), 210 chrome::GetChannel(),
214 gcm::GetProductCategoryForSubtypes(profile->GetPrefs()), 211 gcm::GetProductCategoryForSubtypes(profile->GetPrefs()),
215 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider( 212 std::unique_ptr<ProfileIdentityProvider>(new ProfileIdentityProvider(
216 SigninManagerFactory::GetForProfile(profile), 213 SigninManagerFactory::GetForProfile(profile),
217 ProfileOAuth2TokenServiceFactory::GetForProfile(profile), 214 ProfileOAuth2TokenServiceFactory::GetForProfile(profile),
218 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile( 215 LoginUIServiceFactory::GetShowLoginPopupCallbackForProfile(
219 profile))), 216 profile))),
220 base::WrapUnique(new gcm::FakeGCMClientFactory(ui_thread, io_thread)), 217 base::WrapUnique(new gcm::FakeGCMClientFactory(ui_thread, io_thread)),
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 478
482 // App handler is removed when the extension is updated to the version that 479 // App handler is removed when the extension is updated to the version that
483 // has GCM permission removed. 480 // has GCM permission removed.
484 UpdateExtension(extension.get(), "good2.crx"); 481 UpdateExtension(extension.get(), "good2.crx");
485 waiter()->PumpUILoop(); 482 waiter()->PumpUILoop();
486 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero()); 483 EXPECT_TRUE(gcm_app_handler()->app_handler_count_drop_to_zero());
487 EXPECT_FALSE(HasAppHandlers(extension->id())); 484 EXPECT_FALSE(HasAppHandlers(extension->id()));
488 } 485 }
489 486
490 } // namespace extensions 487 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698