OLD | NEW |
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/string_number_conversions.h" | 5 #include "base/string_number_conversions.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/browser_signin.h" | 8 #include "chrome/browser/browser_signin.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 virtual void RequestSignin(TabContents* tab_contents, | 79 virtual void RequestSignin(TabContents* tab_contents, |
80 const string16& preferred_email, | 80 const string16& preferred_email, |
81 const string16& message, | 81 const string16& message, |
82 SigninDelegate* delegate) { | 82 SigninDelegate* delegate) { |
83 if (should_succeed_) { | 83 if (should_succeed_) { |
84 // Simulate valid login. | 84 // Simulate valid login. |
85 username_ = username_after_login_; | 85 username_ = username_after_login_; |
86 delegate->OnLoginSuccess(); | 86 delegate->OnLoginSuccess(); |
87 | 87 |
88 // Fake a token available notification. | 88 // Fake a token available notification. |
89 Profile* profile = tab_contents->profile()->GetOriginalProfile(); | 89 Profile* profile = |
| 90 static_cast<Profile*>(tab_contents->context())->GetOriginalProfile(); |
90 TokenService* token_service = profile->GetTokenService(); | 91 TokenService* token_service = profile->GetTokenService(); |
91 token_service->IssueAuthTokenForTest(GaiaConstants::kGaiaService, | 92 token_service->IssueAuthTokenForTest(GaiaConstants::kGaiaService, |
92 "new_token"); | 93 "new_token"); |
93 } else { | 94 } else { |
94 delegate->OnLoginFailure(GoogleServiceAuthError( | 95 delegate->OnLoginFailure(GoogleServiceAuthError( |
95 GoogleServiceAuthError::REQUEST_CANCELED)); | 96 GoogleServiceAuthError::REQUEST_CANCELED)); |
96 } | 97 } |
97 } | 98 } |
98 | 99 |
99 private: | 100 private: |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 RunLoginTest("browser_login/expect_nonempty.html", | 187 RunLoginTest("browser_login/expect_nonempty.html", |
187 "foo@bar.com", false, ""); | 188 "foo@bar.com", false, ""); |
188 | 189 |
189 RunLoginTest("browser_login/prompt_no_preferred.html", "", true, ""); | 190 RunLoginTest("browser_login/prompt_no_preferred.html", "", true, ""); |
190 | 191 |
191 RunLoginTest("browser_login/prompt_preferred.html", "", true, "foo@bar.com"); | 192 RunLoginTest("browser_login/prompt_preferred.html", "", true, "foo@bar.com"); |
192 | 193 |
193 RunLoginTest("browser_login/prompt_login_fails.html", | 194 RunLoginTest("browser_login/prompt_login_fails.html", |
194 "", false, "foo@bar.com"); | 195 "", false, "foo@bar.com"); |
195 } | 196 } |
OLD | NEW |