| OLD | NEW |
| 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 "chrome/browser/signin/signin_manager.h" | 5 #include "chrome/browser/signin/signin_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 SetupFetcherAndComplete(GaiaUrls::GetInstance()->merge_session_url(), 200, | 167 SetupFetcherAndComplete(GaiaUrls::GetInstance()->merge_session_url(), 200, |
| 168 cookies, "<html></html>"); | 168 cookies, "<html></html>"); |
| 169 } | 169 } |
| 170 | 170 |
| 171 void WaitUntilUIDone() { | 171 void WaitUntilUIDone() { |
| 172 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 172 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 173 BrowserThread::PostTask( | 173 BrowserThread::PostTask( |
| 174 BrowserThread::IO, FROM_HERE, | 174 BrowserThread::IO, FROM_HERE, |
| 175 base::Bind(&SigninManagerTest::NotifyUIOnComplete, | 175 base::Bind(&SigninManagerTest::NotifyUIOnComplete, |
| 176 base::Unretained(this))); | 176 base::Unretained(this))); |
| 177 MessageLoop::current()->Run(); | 177 base::MessageLoop::current()->Run(); |
| 178 } | 178 } |
| 179 | 179 |
| 180 void NotifyUIOnComplete () { | 180 void NotifyUIOnComplete () { |
| 181 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { | 181 if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { |
| 182 // Redo on UI thread. | 182 // Redo on UI thread. |
| 183 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 183 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 184 base::Bind(&SigninManagerTest::NotifyUIOnComplete, | 184 base::Bind(&SigninManagerTest::NotifyUIOnComplete, |
| 185 base::Unretained(this))); | 185 base::Unretained(this))); |
| 186 return; | 186 return; |
| 187 } | 187 } |
| 188 MessageLoop::current()->Quit(); | 188 base::MessageLoop::current()->Quit(); |
| 189 } | 189 } |
| 190 | 190 |
| 191 void ExpectSignInWithCredentialsSuccess() { | 191 void ExpectSignInWithCredentialsSuccess() { |
| 192 EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); | 192 EXPECT_TRUE(manager_->GetAuthenticatedUsername().empty()); |
| 193 | 193 |
| 194 SimulateValidResponseSignInWithCredentials(); | 194 SimulateValidResponseSignInWithCredentials(); |
| 195 | 195 |
| 196 EXPECT_FALSE(manager_->GetAuthenticatedUsername().empty()); | 196 EXPECT_FALSE(manager_->GetAuthenticatedUsername().empty()); |
| 197 | 197 |
| 198 // This is flow, the oauth2 credentials should already be available in | 198 // This is flow, the oauth2 credentials should already be available in |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 GURL("http://accounts.google.com/ServiceLogin?service=chromiumsync"))); | 520 GURL("http://accounts.google.com/ServiceLogin?service=chromiumsync"))); |
| 521 // http, not https, should not be treated as web based signin. | 521 // http, not https, should not be treated as web based signin. |
| 522 EXPECT_FALSE(SigninManager::IsWebBasedSigninFlowURL( | 522 EXPECT_FALSE(SigninManager::IsWebBasedSigninFlowURL( |
| 523 GURL("http://accounts.google.com/ServiceLogin?service=googlemail"))); | 523 GURL("http://accounts.google.com/ServiceLogin?service=googlemail"))); |
| 524 // chromiumsync is double-embedded in a continue query param. | 524 // chromiumsync is double-embedded in a continue query param. |
| 525 EXPECT_TRUE(SigninManager::IsWebBasedSigninFlowURL( | 525 EXPECT_TRUE(SigninManager::IsWebBasedSigninFlowURL( |
| 526 GURL("https://accounts.google.com/CheckCookie?" | 526 GURL("https://accounts.google.com/CheckCookie?" |
| 527 "continue=https%3A%2F%2Fwww.google.com%2Fintl%2Fen-US%2Fchrome" | 527 "continue=https%3A%2F%2Fwww.google.com%2Fintl%2Fen-US%2Fchrome" |
| 528 "%2Fblank.html%3Fsource%3D3%26nonadv%3D1&service=chromiumsync"))); | 528 "%2Fblank.html%3Fsource%3D3%26nonadv%3D1&service=chromiumsync"))); |
| 529 } | 529 } |
| OLD | NEW |