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

Side by Side Diff: chrome/browser/profiles/profile_manager_browsertest.cc

Issue 839193002: Move ServiceAccessType into //components/keyed_service (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compilation on android Created 5 years, 11 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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/password_manager/password_store_factory.h" 9 #include "chrome/browser/password_manager/password_store_factory.h"
10 #include "chrome/browser/profiles/profile_info_cache.h" 10 #include "chrome/browser/profiles/profile_info_cache.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 form.scheme = autofill::PasswordForm::SCHEME_HTML; 413 form.scheme = autofill::PasswordForm::SCHEME_HTML;
414 form.origin = GURL("http://accounts.google.com/LoginAuth"); 414 form.origin = GURL("http://accounts.google.com/LoginAuth");
415 form.signon_realm = "http://accounts.google.com/"; 415 form.signon_realm = "http://accounts.google.com/";
416 form.username_value = base::ASCIIToUTF16("my_username"); 416 form.username_value = base::ASCIIToUTF16("my_username");
417 form.password_value = base::ASCIIToUTF16("my_password"); 417 form.password_value = base::ASCIIToUTF16("my_password");
418 form.ssl_valid = false; 418 form.ssl_valid = false;
419 form.preferred = true; 419 form.preferred = true;
420 form.blacklisted_by_user = false; 420 form.blacklisted_by_user = false;
421 421
422 scoped_refptr<password_manager::PasswordStore> password_store = 422 scoped_refptr<password_manager::PasswordStore> password_store =
423 PasswordStoreFactory::GetForProfile(profile, Profile::EXPLICIT_ACCESS) 423 PasswordStoreFactory::GetForProfile(
424 .get(); 424 profile, ServiceAccessType::EXPLICIT_ACCESS).get();
425 ASSERT_TRUE(password_store.get()); 425 ASSERT_TRUE(password_store.get());
426 426
427 password_store->AddLogin(form); 427 password_store->AddLogin(form);
428 PasswordStoreConsumerVerifier verify_add; 428 PasswordStoreConsumerVerifier verify_add;
429 password_store->GetAutofillableLogins(&verify_add); 429 password_store->GetAutofillableLogins(&verify_add);
430 430
431 ProfileManager* profile_manager = g_browser_process->profile_manager(); 431 ProfileManager* profile_manager = g_browser_process->profile_manager();
432 profile_manager->ScheduleProfileForDeletion(profile->GetPath(), 432 profile_manager->ScheduleProfileForDeletion(profile->GetPath(),
433 ProfileManager::CreateCallback()); 433 ProfileManager::CreateCallback());
434 content::RunAllPendingInMessageLoop(); 434 content::RunAllPendingInMessageLoop();
435 PasswordStoreConsumerVerifier verify_delete; 435 PasswordStoreConsumerVerifier verify_delete;
436 password_store->GetAutofillableLogins(&verify_delete); 436 password_store->GetAutofillableLogins(&verify_delete);
437 437
438 // Run the password background thread. 438 // Run the password background thread.
439 base::RunLoop run_loop; 439 base::RunLoop run_loop;
440 base::Closure task = base::Bind( 440 base::Closure task = base::Bind(
441 base::IgnoreResult(&content::BrowserThread::PostTask), 441 base::IgnoreResult(&content::BrowserThread::PostTask),
442 content::BrowserThread::UI, 442 content::BrowserThread::UI,
443 FROM_HERE, 443 FROM_HERE,
444 run_loop.QuitClosure()); 444 run_loop.QuitClosure());
445 EXPECT_TRUE(password_store->ScheduleTask(task)); 445 EXPECT_TRUE(password_store->ScheduleTask(task));
446 run_loop.Run(); 446 run_loop.Run();
447 447
448 EXPECT_TRUE(verify_add.IsCalled()); 448 EXPECT_TRUE(verify_add.IsCalled());
449 EXPECT_EQ(1u, verify_add.GetPasswords().size()); 449 EXPECT_EQ(1u, verify_add.GetPasswords().size());
450 EXPECT_TRUE(verify_delete.IsCalled()); 450 EXPECT_TRUE(verify_delete.IsCalled());
451 EXPECT_EQ(0u, verify_delete.GetPasswords().size()); 451 EXPECT_EQ(0u, verify_delete.GetPasswords().size());
452 } 452 }
453 #endif // !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS) 453 #endif // !defined(OS_WIN) && !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
OLDNEW
« no previous file with comments | « chrome/browser/profiles/profile_manager.cc ('k') | chrome/browser/profiles/profile_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698