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

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

Issue 11413050: chrome/browser: Update calls from RunAllPending() to RunUntilIdle(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_settings_test_helper.h" 5 #include "chrome/browser/chromeos/settings/device_settings_test_helper.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/threading/sequenced_worker_pool.h" 8 #include "base/threading/sequenced_worker_pool.h"
9 #include "chrome/browser/chromeos/settings/device_settings_service.h" 9 #include "chrome/browser/chromeos/settings/device_settings_service.h"
10 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h" 10 #include "chrome/browser/chromeos/settings/mock_owner_key_util.h"
11 #include "content/public/browser/browser_thread.h" 11 #include "content/public/browser/browser_thread.h"
12 12
13 namespace chromeos { 13 namespace chromeos {
14 14
15 DeviceSettingsTestHelper::DeviceSettingsTestHelper() 15 DeviceSettingsTestHelper::DeviceSettingsTestHelper()
16 : store_result_(true) {} 16 : store_result_(true) {}
17 17
18 DeviceSettingsTestHelper::~DeviceSettingsTestHelper() {} 18 DeviceSettingsTestHelper::~DeviceSettingsTestHelper() {}
19 19
20 void DeviceSettingsTestHelper::FlushLoops() { 20 void DeviceSettingsTestHelper::FlushLoops() {
21 // DeviceSettingsService may trigger operations that hop back and forth 21 // DeviceSettingsService may trigger operations that hop back and forth
22 // between the message loop and the blocking pool. 2 iterations are currently 22 // between the message loop and the blocking pool. 2 iterations are currently
23 // sufficient (key loading, signing). 23 // sufficient (key loading, signing).
24 for (int i = 0; i < 2; ++i) { 24 for (int i = 0; i < 2; ++i) {
25 MessageLoop::current()->RunAllPending(); 25 MessageLoop::current()->RunUntilIdle();
26 content::BrowserThread::GetBlockingPool()->FlushForTesting(); 26 content::BrowserThread::GetBlockingPool()->FlushForTesting();
27 } 27 }
28 MessageLoop::current()->RunAllPending(); 28 MessageLoop::current()->RunUntilIdle();
29 } 29 }
30 30
31 void DeviceSettingsTestHelper::FlushStore() { 31 void DeviceSettingsTestHelper::FlushStore() {
32 std::vector<StorePolicyCallback> callbacks; 32 std::vector<StorePolicyCallback> callbacks;
33 callbacks.swap(store_callbacks_); 33 callbacks.swap(store_callbacks_);
34 for (std::vector<StorePolicyCallback>::iterator cb(callbacks.begin()); 34 for (std::vector<StorePolicyCallback>::iterator cb(callbacks.begin());
35 cb != callbacks.end(); ++cb) { 35 cb != callbacks.end(); ++cb) {
36 cb->Run(store_result_); 36 cb->Run(store_result_);
37 } 37 }
38 } 38 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 DeviceSettingsService::Get()->Load(); 116 DeviceSettingsService::Get()->Load();
117 Flush(); 117 Flush();
118 } 118 }
119 119
120 ScopedDeviceSettingsTestHelper::~ScopedDeviceSettingsTestHelper() { 120 ScopedDeviceSettingsTestHelper::~ScopedDeviceSettingsTestHelper() {
121 Flush(); 121 Flush();
122 DeviceSettingsService::Get()->Shutdown(); 122 DeviceSettingsService::Get()->Shutdown();
123 } 123 }
124 124
125 } // namespace chromeos 125 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698