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

Side by Side Diff: chrome/browser/chromeos/settings/device_oauth2_token_service_unittest.cc

Issue 552363002: BlockingPool is flushed in DeviceOAuth2TokenServiceTest to prevent memory leaks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/settings/device_oauth2_token_service.h" 5 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
6 6
7 #include "base/message_loop/message_loop.h" 7 #include "base/message_loop/message_loop.h"
8 #include "base/prefs/testing_pref_service.h" 8 #include "base/prefs/testing_pref_service.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/threading/sequenced_worker_pool.h"
10 #include "chrome/browser/chromeos/policy/device_policy_builder.h" 11 #include "chrome/browser/chromeos/policy/device_policy_builder.h"
11 #include "chrome/browser/chromeos/settings/cros_settings.h" 12 #include "chrome/browser/chromeos/settings/cros_settings.h"
12 #include "chrome/browser/chromeos/settings/device_settings_service.h" 13 #include "chrome/browser/chromeos/settings/device_settings_service.h"
13 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h" 14 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
14 #include "chrome/browser/chromeos/settings/token_encryptor.h" 15 #include "chrome/browser/chromeos/settings/token_encryptor.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "chrome/test/base/scoped_testing_local_state.h" 17 #include "chrome/test/base/scoped_testing_local_state.h"
17 #include "chrome/test/base/testing_browser_process.h" 18 #include "chrome/test/base/testing_browser_process.h"
18 #include "chromeos/cryptohome/system_salt_getter.h" 19 #include "chromeos/cryptohome/system_salt_getter.h"
19 #include "chromeos/dbus/dbus_thread_manager.h" 20 #include "chromeos/dbus/dbus_thread_manager.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 *device_policy_.GetSigningKey()); 91 *device_policy_.GetSigningKey());
91 DeviceSettingsService::Get()->SetSessionManager( 92 DeviceSettingsService::Get()->SetSessionManager(
92 &device_settings_test_helper_, owner_key_util_); 93 &device_settings_test_helper_, owner_key_util_);
93 94
94 CrosSettings::Initialize(); 95 CrosSettings::Initialize();
95 } 96 }
96 97
97 virtual void TearDown() OVERRIDE { 98 virtual void TearDown() OVERRIDE {
98 CrosSettings::Shutdown(); 99 CrosSettings::Shutdown();
99 TestingBrowserProcess::GetGlobal()->SetBrowserPolicyConnector(NULL); 100 TestingBrowserProcess::GetGlobal()->SetBrowserPolicyConnector(NULL);
101 content::BrowserThread::GetBlockingPool()->FlushForTesting();
100 DeviceSettingsService::Get()->UnsetSessionManager(); 102 DeviceSettingsService::Get()->UnsetSessionManager();
101 DeviceSettingsService::Shutdown(); 103 DeviceSettingsService::Shutdown();
102 SystemSaltGetter::Shutdown(); 104 SystemSaltGetter::Shutdown();
103 DBusThreadManager::Shutdown(); 105 DBusThreadManager::Shutdown();
104 base::RunLoop().RunUntilIdle(); 106 base::RunLoop().RunUntilIdle();
105 } 107 }
106 108
107 void CreateService() { 109 void CreateService() {
108 oauth2_service_.reset(new DeviceOAuth2TokenService( 110 oauth2_service_.reset(new DeviceOAuth2TokenService(
109 request_context_getter_.get(), scoped_testing_local_state_.Get())); 111 request_context_getter_.get(), scoped_testing_local_state_.Get()));
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 424
423 AssertConsumerTokensAndErrors(0, 1); 425 AssertConsumerTokensAndErrors(0, 1);
424 426
425 // Retry should succeed. 427 // Retry should succeed.
426 request = StartTokenRequest(); 428 request = StartTokenRequest();
427 PerformURLFetches(); 429 PerformURLFetches();
428 AssertConsumerTokensAndErrors(1, 1); 430 AssertConsumerTokensAndErrors(1, 1);
429 } 431 }
430 432
431 } // namespace chromeos 433 } // namespace chromeos
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