| 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/settings/profile_info_handler.h" | 5 #include "chrome/browser/ui/webui/settings/profile_info_handler.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "chrome/common/pref_names.h" | 9 #include "chrome/common/pref_names.h" |
| 10 #include "chrome/test/base/testing_browser_process.h" | 10 #include "chrome/test/base/testing_browser_process.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 TEST_F(ProfileInfoHandlerTest, PushProfileManagesSupervisedUsers) { | 175 TEST_F(ProfileInfoHandlerTest, PushProfileManagesSupervisedUsers) { |
| 176 handler()->AllowJavascript(); | 176 handler()->AllowJavascript(); |
| 177 | 177 |
| 178 // The handler is notified of the change after |update| is destroyed. | 178 // The handler is notified of the change after |update| is destroyed. |
| 179 std::unique_ptr<DictionaryPrefUpdate> update( | 179 std::unique_ptr<DictionaryPrefUpdate> update( |
| 180 new DictionaryPrefUpdate(profile()->GetPrefs(), prefs::kSupervisedUsers)); | 180 new DictionaryPrefUpdate(profile()->GetPrefs(), prefs::kSupervisedUsers)); |
| 181 base::DictionaryValue* dict = update->Get(); | 181 base::DictionaryValue* dict = update->Get(); |
| 182 dict->SetWithoutPathExpansion("supervised-user-id", | 182 dict->SetWithoutPathExpansion("supervised-user-id", |
| 183 new base::DictionaryValue); | 183 base::MakeUnique<base::DictionaryValue>()); |
| 184 update.reset(); | 184 update.reset(); |
| 185 | 185 |
| 186 EXPECT_EQ(1U, web_ui()->call_data().size()); | 186 EXPECT_EQ(1U, web_ui()->call_data().size()); |
| 187 | 187 |
| 188 const content::TestWebUI::CallData& data = *web_ui()->call_data().back(); | 188 const content::TestWebUI::CallData& data = *web_ui()->call_data().back(); |
| 189 EXPECT_EQ("cr.webUIListenerCallback", data.function_name()); | 189 EXPECT_EQ("cr.webUIListenerCallback", data.function_name()); |
| 190 | 190 |
| 191 std::string event_id; | 191 std::string event_id; |
| 192 ASSERT_TRUE(data.arg1()->GetAsString(&event_id)); | 192 ASSERT_TRUE(data.arg1()->GetAsString(&event_id)); |
| 193 EXPECT_EQ(ProfileInfoHandler::kProfileManagesSupervisedUsersChangedEventName, | 193 EXPECT_EQ(ProfileInfoHandler::kProfileManagesSupervisedUsersChangedEventName, |
| 194 event_id); | 194 event_id); |
| 195 | 195 |
| 196 bool has_supervised_users = false; | 196 bool has_supervised_users = false; |
| 197 ASSERT_TRUE(data.arg2()->GetAsBoolean(&has_supervised_users)); | 197 ASSERT_TRUE(data.arg2()->GetAsBoolean(&has_supervised_users)); |
| 198 EXPECT_TRUE(has_supervised_users); | 198 EXPECT_TRUE(has_supervised_users); |
| 199 } | 199 } |
| 200 | 200 |
| 201 } // namespace settings | 201 } // namespace settings |
| OLD | NEW |