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

Side by Side Diff: chrome/browser/chromeos/login/login_manager_test.cc

Issue 964563002: Replace SetAuthenticatedUsername with SetAuthenticatedAccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@priv
Patch Set: rebased Created 5 years, 8 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/chromeos/login/login_manager_test.h" 5 #include "chrome/browser/chromeos/login/login_manager_test.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 it != logged_users.end(); 129 it != logged_users.end();
130 ++it) { 130 ++it) {
131 if ((*it)->email() == user_context.GetUserID()) 131 if ((*it)->email() == user_context.GetUserID())
132 return true; 132 return true;
133 } 133 }
134 return false; 134 return false;
135 } 135 }
136 136
137 void LoginManagerTest::LoginUser(const std::string& user_id) { 137 void LoginManagerTest::LoginUser(const std::string& user_id) {
138 UserContext user_context(user_id); 138 UserContext user_context(user_id);
139 user_context.SetGaiaID(GetGaiaIDForUserID(user_id));
139 user_context.SetKey(Key("password")); 140 user_context.SetKey(Key("password"));
140 SetExpectedCredentials(user_context); 141 SetExpectedCredentials(user_context);
141 EXPECT_TRUE(TryToLogin(user_context)); 142 EXPECT_TRUE(TryToLogin(user_context));
142 } 143 }
143 144
144 void LoginManagerTest::AddUser(const std::string& user_id) { 145 void LoginManagerTest::AddUser(const std::string& user_id) {
145 UserContext user_context(user_id); 146 UserContext user_context(user_id);
147 user_context.SetGaiaID(GetGaiaIDForUserID(user_id));
146 user_context.SetKey(Key("password")); 148 user_context.SetKey(Key("password"));
147 SetExpectedCredentials(user_context); 149 SetExpectedCredentials(user_context);
148 EXPECT_TRUE(AddUserToSession(user_context)); 150 EXPECT_TRUE(AddUserToSession(user_context));
149 } 151 }
150 152
153 // static
154 std::string LoginManagerTest::GetGaiaIDForUserID(const std::string& user_id) {
155 return "gaia-id-" + user_id;
156 }
157
151 void LoginManagerTest::JSExpect(const std::string& expression) { 158 void LoginManagerTest::JSExpect(const std::string& expression) {
152 js_checker_.ExpectTrue(expression); 159 js_checker_.ExpectTrue(expression);
153 } 160 }
154 161
155 void LoginManagerTest::InitializeWebContents() { 162 void LoginManagerTest::InitializeWebContents() {
156 LoginDisplayHost* host = LoginDisplayHostImpl::default_host(); 163 LoginDisplayHost* host = LoginDisplayHostImpl::default_host();
157 EXPECT_TRUE(host != NULL); 164 EXPECT_TRUE(host != NULL);
158 165
159 content::WebContents* web_contents = 166 content::WebContents* web_contents =
160 host->GetWebUILoginView()->GetWebContents(); 167 host->GetWebUILoginView()->GetWebContents();
161 EXPECT_TRUE(web_contents != NULL); 168 EXPECT_TRUE(web_contents != NULL);
162 set_web_contents(web_contents); 169 set_web_contents(web_contents);
163 js_checker_.set_web_contents(web_contents); 170 js_checker_.set_web_contents(web_contents);
164 } 171 }
165 172
166 } // namespace chromeos 173 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698