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

Unified Diff: chrome/browser/password_manager/password_store_win_unittest.cc

Issue 8274012: Wait for URLBlacklist update tasks on automation tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added BrowserThread::WaitForPendingTasksOn, removed SignalingTask Created 9 years, 2 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/password_manager/password_store_win_unittest.cc
diff --git a/chrome/browser/password_manager/password_store_win_unittest.cc b/chrome/browser/password_manager/password_store_win_unittest.cc
index 6b187c230dd9198791c14dc1a5166ea066c10bf9..e9803134a126f10ce6648621d7e33334d96599c8 100644
--- a/chrome/browser/password_manager/password_store_win_unittest.cc
+++ b/chrome/browser/password_manager/password_store_win_unittest.cc
@@ -11,7 +11,6 @@
#include "base/message_loop.h"
#include "base/scoped_temp_dir.h"
#include "base/stl_util.h"
-#include "base/synchronization/waitable_event.h"
#include "base/time.h"
#include "chrome/browser/password_manager/ie7_password.h"
#include "chrome/browser/password_manager/password_form_data.h"
@@ -20,13 +19,11 @@
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/webdata/web_data_service.h"
#include "chrome/common/pref_names.h"
-#include "chrome/test/base/signaling_task.h"
#include "chrome/test/base/testing_profile.h"
#include "content/browser/browser_thread.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
-using base::WaitableEvent;
using testing::_;
using testing::DoAll;
using testing::WithArg;
@@ -162,10 +159,7 @@ TEST_F(PasswordStoreWinTest, DISABLED_ConvertIE7Login) {
// The WDS schedules tasks to run on the DB thread so we schedule yet another
// task to notify us that it's safe to carry on with the test.
- WaitableEvent done(false, false);
- BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
- new SignalingTask(&done));
- done.Wait();
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::DB));
// Prentend that the migration has already taken place.
profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated,
@@ -274,10 +268,7 @@ TEST_F(PasswordStoreWinTest, DISABLED_MultipleWDSQueriesOnDifferentThreads) {
// The WDS schedules tasks to run on the DB thread so we schedule yet another
// task to notify us that it's safe to carry on with the test.
- WaitableEvent done(false, false);
- BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
- new SignalingTask(&done));
- done.Wait();
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::DB));
// Prentend that the migration has already taken place.
profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated,
@@ -430,10 +421,7 @@ TEST_F(PasswordStoreWinTest, Migration) {
// The WDS schedules tasks to run on the DB thread so we schedule yet another
// task to notify us that it's safe to carry on with the test.
- WaitableEvent done(false, false);
- BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
- new SignalingTask(&done));
- done.Wait();
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::DB));
// Initializing the PasswordStore should trigger a migration.
scoped_refptr<PasswordStore> store(
@@ -446,9 +434,7 @@ TEST_F(PasswordStoreWinTest, Migration) {
// Again, the WDS schedules tasks to run on the DB thread, so schedule a task
// to signal us when it is safe to continue.
- BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
- new SignalingTask(&done));
- done.Wait();
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::DB));
// Let the WDS callbacks proceed so the logins can be migrated.
MessageLoop::current()->RunAllPending();
@@ -491,9 +477,7 @@ TEST_F(PasswordStoreWinTest, Migration) {
wds_->GetAutofillableLogins(&wds_consumer);
// Wait for the WDS methods to execute on the DB thread.
- BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
- new SignalingTask(&done));
- done.Wait();
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::DB));
// Handle the callback from the WDS.
MessageLoop::current()->RunAllPending();
@@ -505,9 +489,7 @@ TEST_F(PasswordStoreWinTest, Migration) {
wds_->GetBlacklistLogins(&wds_consumer);
// Wait for the WDS methods to execute on the DB thread.
- BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
- new SignalingTask(&done));
- done.Wait();
+ CHECK(BrowserThread::WaitForPendingTasksOn(BrowserThread::DB));
// Handle the callback from the WDS.
MessageLoop::current()->RunAllPending();

Powered by Google App Engine
This is Rietveld 408576698