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

Unified Diff: chrome/browser/chromeos/settings/device_settings_test_helper.cc

Issue 409743003: Use content::RunBlockingPoolTask() in tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed. 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/settings/device_settings_test_helper.cc
diff --git a/chrome/browser/chromeos/settings/device_settings_test_helper.cc b/chrome/browser/chromeos/settings/device_settings_test_helper.cc
index 06fd21c3abe9cdb2d824ba271091bc00300b7c24..9898b7c2f78c4b8f76499c38f1e1ccbcb865c2e1 100644
--- a/chrome/browser/chromeos/settings/device_settings_test_helper.cc
+++ b/chrome/browser/chromeos/settings/device_settings_test_helper.cc
@@ -17,6 +17,7 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "components/ownership/mock_owner_key_util.h"
#include "content/public/browser/browser_thread.h"
+#include "content/public/test/test_utils.h"
namespace chromeos {
@@ -24,17 +25,6 @@ DeviceSettingsTestHelper::DeviceSettingsTestHelper() {}
DeviceSettingsTestHelper::~DeviceSettingsTestHelper() {}
-void DeviceSettingsTestHelper::FlushLoops() {
- // DeviceSettingsService may trigger operations that hop back and forth
- // between the message loop and the blocking pool. 2 iterations are currently
- // sufficient (key loading, signing).
- for (int i = 0; i < 2; ++i) {
- base::MessageLoop::current()->RunUntilIdle();
- content::BrowserThread::GetBlockingPool()->FlushForTesting();
- }
- base::MessageLoop::current()->RunUntilIdle();
-}
-
void DeviceSettingsTestHelper::FlushStore() {
std::vector<StorePolicyCallback> callbacks;
callbacks.swap(device_policy_.store_callbacks_);
@@ -78,11 +68,11 @@ void DeviceSettingsTestHelper::FlushRetrieve() {
void DeviceSettingsTestHelper::Flush() {
do {
- FlushLoops();
+ content::RunAllBlockingPoolTasksUntilIdle();
FlushStore();
- FlushLoops();
+ content::RunAllBlockingPoolTasksUntilIdle();
FlushRetrieve();
- FlushLoops();
+ content::RunAllBlockingPoolTasksUntilIdle();
} while (HasPendingOperations());
}

Powered by Google App Engine
This is Rietveld 408576698