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

Unified Diff: chrome/browser/signin/signin_manager_unittest.cc

Issue 12546016: Remove the Extensions URLRequestContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: android webview init fix merged in. Created 7 years, 4 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/signin/signin_manager_unittest.cc
diff --git a/chrome/browser/signin/signin_manager_unittest.cc b/chrome/browser/signin/signin_manager_unittest.cc
index f008430cf37a7db7b9b322562cc2e717e29db8d2..160a03ae47cc106f3ed2d1d5efedf0e0c45f1143 100644
--- a/chrome/browser/signin/signin_manager_unittest.cc
+++ b/chrome/browser/signin/signin_manager_unittest.cc
@@ -23,7 +23,9 @@
#include "chrome/test/base/testing_profile.h"
#include "components/webdata/encryptor/encryptor.h"
#include "content/public/browser/child_process_security_policy.h"
+#include "content/public/browser/storage_partition.h"
#include "content/public/test/test_browser_thread_bundle.h"
+#include "content/public/test/test_utils.h"
#include "google_apis/gaia/gaia_constants.h"
#include "google_apis/gaia/gaia_urls.h"
#include "net/cookies/cookie_monster.h"
@@ -200,6 +202,12 @@ class SigninManagerTest : public TokenServiceTestHarness {
manager_->SignOut();
}
+ net::CookieMonster* GetCookieMonster(const GURL& origin) {
+ // Since it's a unittest, assume default StoragePartition.
+ return content::BrowserContext::GetDefaultStoragePartition(profile())->
+ GetCookieStoreForScheme(origin.scheme())->GetCookieMonster();
+ }
+
net::TestURLFetcherFactory factory_;
scoped_ptr<SigninManager> manager_;
content::TestNotificationTracker google_login_success_;
@@ -289,14 +297,14 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordValidCookie) {
EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
// Set a valid LSID cookie in the test cookie store.
- scoped_refptr<net::CookieMonster> cookie_monster =
- profile()->GetCookieMonster();
+ GURL origin("https://accounts.google.com");
+ scoped_refptr<net::CookieMonster> cookie_monster = GetCookieMonster(origin);
net::CookieOptions options;
options.set_include_httponly();
cookie_monster->SetCookieWithOptionsAsync(
- GURL("https://accounts.google.com"),
- "LSID=1234; secure; httponly", options,
- net::CookieMonster::SetCookiesCallback());
+ origin,
+ "LSID=1234; secure; httponly", options,
+ net::CookieMonster::SetCookiesCallback());
// Since the password is empty, will verify the gaia cookies first.
manager_->StartSignInWithCredentials(
@@ -334,14 +342,14 @@ TEST_F(SigninManagerTest, SignInWithCredentialsEmptyPasswordInValidCookie) {
EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty());
// Set an invalid LSID cookie in the test cookie store.
- scoped_refptr<net::CookieMonster> cookie_monster =
- profile()->GetCookieMonster();
+ GURL origin("https://accounts.google.com");
+ scoped_refptr<net::CookieMonster> cookie_monster = GetCookieMonster(origin);
net::CookieOptions options;
options.set_include_httponly();
cookie_monster->SetCookieWithOptionsAsync(
- GURL("https://accounts.google.com"),
- "LSID=1234; domain=google.com; secure; httponly", options,
- net::CookieMonster::SetCookiesCallback());
+ origin,
+ "LSID=1234; domain=google.com; secure; httponly", options,
+ net::CookieMonster::SetCookiesCallback());
// Since the password is empty, must verify the gaia cookies first.
manager_->StartSignInWithCredentials(

Powered by Google App Engine
This is Rietveld 408576698