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

Side by Side Diff: chrome/browser/ui/webui/signin/signin_create_profile_handler_unittest.cc

Issue 2163173004: Updates the list of signed-in profiles in user manager on ProfileAuthInfoChanged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« no previous file with comments | « chrome/browser/ui/webui/signin/signin_create_profile_handler.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ui/webui/signin/signin_create_profile_handler.h" 5 #include "chrome/browser/ui/webui/signin/signin_create_profile_handler.h"
6 6
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/prefs/browser_prefs.h" 8 #include "chrome/browser/prefs/browser_prefs.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/profiles/profile_attributes_entry.h" 10 #include "chrome/browser/profiles/profile_attributes_entry.h"
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 0, 221 0,
222 kSupervisedUserId2, // supervised_user_id 222 kSupervisedUserId2, // supervised_user_id
223 TestingProfile::TestingFactories()); 223 TestingProfile::TestingFactories());
224 224
225 EXPECT_EQ(2u, 225 EXPECT_EQ(2u,
226 profile_manager()->profile_attributes_storage()->GetNumberOfProfiles()); 226 profile_manager()->profile_attributes_storage()->GetNumberOfProfiles());
227 #endif 227 #endif
228 } 228 }
229 229
230 void TearDown() override { 230 void TearDown() override {
231 handler_.reset();
231 profile_manager_.reset(); 232 profile_manager_.reset();
232 handler_.reset();
233 BrowserWithTestWindowTest::TearDown(); 233 BrowserWithTestWindowTest::TearDown();
234 } 234 }
235 235
236 content::TestWebUI* web_ui() { 236 content::TestWebUI* web_ui() {
237 return web_ui_.get(); 237 return web_ui_.get();
238 } 238 }
239 239
240 TestSigninCreateProfileHandler* handler() { 240 TestSigninCreateProfileHandler* handler() {
241 return handler_.get(); 241 return handler_.get();
242 } 242 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 ASSERT_TRUE(profile_1); 298 ASSERT_TRUE(profile_1);
299 Profile* profile_2 = profile_manager()->CreateTestingProfile("profile_2"); 299 Profile* profile_2 = profile_manager()->CreateTestingProfile("profile_2");
300 ASSERT_TRUE(profile_2); 300 ASSERT_TRUE(profile_2);
301 301
302 // Set Auth Info only for profile_2. 302 // Set Auth Info only for profile_2.
303 ProfileAttributesEntry* entry; 303 ProfileAttributesEntry* entry;
304 ASSERT_TRUE(profile_manager()->profile_attributes_storage()-> 304 ASSERT_TRUE(profile_manager()->profile_attributes_storage()->
305 GetProfileAttributesWithPath(profile_2->GetPath(), &entry)); 305 GetProfileAttributesWithPath(profile_2->GetPath(), &entry));
306 entry->SetAuthInfo(kTestGaiaId2, base::UTF8ToUTF16(kTestEmail2)); 306 entry->SetAuthInfo(kTestGaiaId2, base::UTF8ToUTF16(kTestEmail2));
307 307
308 // Request a list of signed in profiles.
309 base::ListValue list_args;
310 handler()->RequestSignedInProfiles(&list_args);
311
312 // Expect a JS callback with a list containing profile_2. 308 // Expect a JS callback with a list containing profile_2.
313 EXPECT_EQ(1U, web_ui()->call_data().size()); 309 EXPECT_EQ(1U, web_ui()->call_data().size());
314 310
315 EXPECT_EQ(kTestWebUIResponse, web_ui()->call_data()[0]->function_name()); 311 EXPECT_EQ(kTestWebUIResponse, web_ui()->call_data()[0]->function_name());
316 312
317 std::string callback_name; 313 std::string callback_name;
318 ASSERT_TRUE(web_ui()->call_data()[0]->arg1()->GetAsString(&callback_name)); 314 ASSERT_TRUE(web_ui()->call_data()[0]->arg1()->GetAsString(&callback_name));
319 EXPECT_EQ("signedin-users-received", callback_name); 315 EXPECT_EQ("signedin-users-received", callback_name);
320 316
321 const base::ListValue* signed_in_profiles; 317 const base::ListValue* signed_in_profiles;
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
601 EXPECT_EQ("create-profile-error", callback_name); 597 EXPECT_EQ("create-profile-error", callback_name);
602 598
603 base::string16 expected_error_message = l10n_util::GetStringUTF16( 599 base::string16 expected_error_message = l10n_util::GetStringUTF16(
604 IDS_PROFILES_CREATE_SUPERVISED_NOT_ALLOWED_BY_POLICY); 600 IDS_PROFILES_CREATE_SUPERVISED_NOT_ALLOWED_BY_POLICY);
605 base::string16 error_message; 601 base::string16 error_message;
606 ASSERT_TRUE(web_ui()->call_data()[0]->arg2()->GetAsString(&error_message)); 602 ASSERT_TRUE(web_ui()->call_data()[0]->arg2()->GetAsString(&error_message));
607 EXPECT_EQ(expected_error_message, error_message); 603 EXPECT_EQ(expected_error_message, error_message);
608 } 604 }
609 605
610 #endif 606 #endif
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/signin/signin_create_profile_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698