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

Side by Side Diff: chrome/browser/password_manager/password_store_default_unittest.cc

Issue 7396013: Linux: revive a mysteriously disabled test and add tests for the GNOME Keyring native backend. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/scoped_temp_dir.h" 6 #include "base/scoped_temp_dir.h"
7 #include "base/stl_util-inl.h" 7 #include "base/stl_util-inl.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
145 MessageLoop::current()->Quit(); 145 MessageLoop::current()->Quit();
146 } 146 }
147 147
148 MATCHER(EmptyWDResult, "") { 148 MATCHER(EmptyWDResult, "") {
149 return static_cast<const WDResult<std::vector<PasswordForm*> >*>( 149 return static_cast<const WDResult<std::vector<PasswordForm*> >*>(
150 arg)->GetValue().empty(); 150 arg)->GetValue().empty();
151 } 151 }
152 152
153 TEST_F(PasswordStoreDefaultTest, NonASCIIData) { 153 TEST_F(PasswordStoreDefaultTest, NonASCIIData) {
154 // Prentend that the migration has already taken place. 154 // Pretend that the migration has already taken place.
155 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, 155 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated,
156 true, 156 true,
157 PrefService::UNSYNCABLE_PREF); 157 PrefService::UNSYNCABLE_PREF);
158 158
159 // Initializing the PasswordStore shouldn't trigger a migration. 159 // Initializing the PasswordStore shouldn't trigger a migration.
160 scoped_refptr<PasswordStoreDefault> store( 160 scoped_refptr<PasswordStoreDefault> store(
161 new PasswordStoreDefault(login_db_.release(), profile_.get(), 161 new PasswordStoreDefault(login_db_.release(), profile_.get(),
162 wds_.get())); 162 wds_.get()));
163 store->Init(); 163 store->Init();
164 164
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 wds_->AddLogin(*form); 392 wds_->AddLogin(*form);
393 } 393 }
394 394
395 // The WDS schedules tasks to run on the DB thread so we schedule yet another 395 // The WDS schedules tasks to run on the DB thread so we schedule yet another
396 // task to notify us that it's safe to carry on with the test. 396 // task to notify us that it's safe to carry on with the test.
397 WaitableEvent done(false, false); 397 WaitableEvent done(false, false);
398 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 398 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
399 new SignalingTask(&done)); 399 new SignalingTask(&done));
400 done.Wait(); 400 done.Wait();
401 401
402 // Prentend that the migration has already taken place. 402 // Pretend that the migration has already taken place.
403 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, 403 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated,
404 true, 404 true,
405 PrefService::UNSYNCABLE_PREF); 405 PrefService::UNSYNCABLE_PREF);
406 406
407 // Initializing the PasswordStore shouldn't trigger a migration. 407 // Initializing the PasswordStore shouldn't trigger a migration.
408 scoped_refptr<PasswordStore> store( 408 scoped_refptr<PasswordStore> store(
409 new PasswordStoreDefault(login_db_.release(), profile_.get(), 409 new PasswordStoreDefault(login_db_.release(), profile_.get(),
410 wds_.get())); 410 wds_.get()));
411 store->Init(); 411 store->Init();
412 412
(...skipping 11 matching lines...) Expand all
424 424
425 store->GetAutofillableLogins(&consumer); 425 store->GetAutofillableLogins(&consumer);
426 MessageLoop::current()->Run(); 426 MessageLoop::current()->Run();
427 427
428 STLDeleteElements(&unexpected_autofillable); 428 STLDeleteElements(&unexpected_autofillable);
429 429
430 store->Shutdown(); 430 store->Shutdown();
431 } 431 }
432 432
433 TEST_F(PasswordStoreDefaultTest, Notifications) { 433 TEST_F(PasswordStoreDefaultTest, Notifications) {
434 // Prentend that the migration has already taken place. 434 // Pretend that the migration has already taken place.
435 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated, 435 profile_->GetPrefs()->RegisterBooleanPref(prefs::kLoginDatabaseMigrated,
436 true, 436 true,
437 PrefService::UNSYNCABLE_PREF); 437 PrefService::UNSYNCABLE_PREF);
438 438
439 // Initializing the PasswordStore shouldn't trigger a migration. 439 // Initializing the PasswordStore shouldn't trigger a migration.
440 scoped_refptr<PasswordStore> store( 440 scoped_refptr<PasswordStore> store(
441 new PasswordStoreDefault(login_db_.release(), profile_.get(), 441 new PasswordStoreDefault(login_db_.release(), profile_.get(),
442 wds_.get())); 442 wds_.get()));
443 store->Init(); 443 store->Init();
444 444
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 // Deleting the login should trigger a notification. 515 // Deleting the login should trigger a notification.
516 store->RemoveLogin(*form); 516 store->RemoveLogin(*form);
517 517
518 // Wait for PasswordStore to send the notification. 518 // Wait for PasswordStore to send the notification.
519 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, 519 BrowserThread::PostTask(BrowserThread::DB, FROM_HERE,
520 new SignalingTask(&done)); 520 new SignalingTask(&done));
521 done.Wait(); 521 done.Wait();
522 522
523 store->Shutdown(); 523 store->Shutdown();
524 } 524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698