| OLD | NEW |
| 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 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 573 base::ListValue list_args; | 573 base::ListValue list_args; |
| 574 list_args.Clear(); | 574 list_args.Clear(); |
| 575 list_args.AppendString(kSupervisedUsername1); | 575 list_args.AppendString(kSupervisedUsername1); |
| 576 list_args.AppendString(profiles::GetDefaultAvatarIconUrl(0)); | 576 list_args.AppendString(profiles::GetDefaultAvatarIconUrl(0)); |
| 577 list_args.AppendBoolean(false); // create_shortcut | 577 list_args.AppendBoolean(false); // create_shortcut |
| 578 list_args.AppendBoolean(true); // is_supervised | 578 list_args.AppendBoolean(true); // is_supervised |
| 579 list_args.AppendString(""); // supervised_user_id | 579 list_args.AppendString(""); // supervised_user_id |
| 580 list_args.AppendString(custodian()->GetPath().value()); | 580 list_args.AppendString(custodian()->GetPath().value()); |
| 581 handler()->CreateProfile(&list_args); | 581 handler()->CreateProfile(&list_args); |
| 582 | 582 |
| 583 // Expect nothing to happen. | 583 // Expect a JS callbacks containing an error message. |
| 584 EXPECT_EQ(0U, web_ui()->call_data().size()); | 584 EXPECT_EQ(1U, web_ui()->call_data().size()); |
| 585 |
| 586 EXPECT_EQ(kTestWebUIResponse, web_ui()->call_data()[0]->function_name()); |
| 587 |
| 588 std::string callback_name; |
| 589 ASSERT_TRUE(web_ui()->call_data()[0]->arg1()->GetAsString(&callback_name)); |
| 590 EXPECT_EQ("create-profile-error", callback_name); |
| 591 |
| 592 base::string16 expected_error_message = l10n_util::GetStringUTF16( |
| 593 IDS_PROFILES_CREATE_SUPERVISED_NOT_ALLOWED_BY_POLICY); |
| 594 base::string16 error_message; |
| 595 ASSERT_TRUE(web_ui()->call_data()[0]->arg2()->GetAsString(&error_message)); |
| 596 EXPECT_EQ(expected_error_message, error_message); |
| 585 } | 597 } |
| OLD | NEW |