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/settings_manage_profile_handler.h" | 5 #include "chrome/browser/ui/webui/settings/settings_manage_profile_handler.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/common/pref_names.h" | 8 #include "chrome/common/pref_names.h" |
9 #include "chrome/test/base/testing_browser_process.h" | 9 #include "chrome/test/base/testing_browser_process.h" |
10 #include "chrome/test/base/testing_profile_manager.h" | 10 #include "chrome/test/base/testing_profile_manager.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 content::TestWebUI* web_ui() { return &web_ui_; } | 58 content::TestWebUI* web_ui() { return &web_ui_; } |
59 Profile* profile() const { return profile_; } | 59 Profile* profile() const { return profile_; } |
60 TestManageProfileHandler* handler() const { return handler_.get(); } | 60 TestManageProfileHandler* handler() const { return handler_.get(); } |
61 | 61 |
62 private: | 62 private: |
63 content::TestBrowserThreadBundle thread_bundle_; | 63 content::TestBrowserThreadBundle thread_bundle_; |
64 TestingProfileManager profile_manager_; | 64 TestingProfileManager profile_manager_; |
65 content::TestWebUI web_ui_; | 65 content::TestWebUI web_ui_; |
66 | 66 |
67 Profile* profile_; | 67 Profile* profile_; |
68 scoped_ptr<TestManageProfileHandler> handler_; | 68 std::unique_ptr<TestManageProfileHandler> handler_; |
69 }; | 69 }; |
70 | 70 |
71 TEST_F(ManageProfileHandlerTest, HandleSetProfileIconAndName) { | 71 TEST_F(ManageProfileHandlerTest, HandleSetProfileIconAndName) { |
72 base::ListValue list_args; | 72 base::ListValue list_args; |
73 list_args.Append( | 73 list_args.Append( |
74 new base::StringValue("chrome://theme/IDR_PROFILE_AVATAR_15")); | 74 new base::StringValue("chrome://theme/IDR_PROFILE_AVATAR_15")); |
75 list_args.Append(new base::StringValue("New Profile Name")); | 75 list_args.Append(new base::StringValue("New Profile Name")); |
76 handler()->HandleSetProfileIconAndName(&list_args); | 76 handler()->HandleSetProfileIconAndName(&list_args); |
77 | 77 |
78 PrefService* pref_service = profile()->GetPrefs(); | 78 PrefService* pref_service = profile()->GetPrefs(); |
(...skipping 30 matching lines...) Expand all Loading... |
109 EXPECT_EQ("cr.webUIListenerCallback", data.function_name()); | 109 EXPECT_EQ("cr.webUIListenerCallback", data.function_name()); |
110 | 110 |
111 std::string event_id; | 111 std::string event_id; |
112 ASSERT_TRUE(data.arg1()->GetAsString(&event_id)); | 112 ASSERT_TRUE(data.arg1()->GetAsString(&event_id)); |
113 EXPECT_EQ("available-icons-changed", event_id); | 113 EXPECT_EQ("available-icons-changed", event_id); |
114 | 114 |
115 VerifyIconList(data.arg2()); | 115 VerifyIconList(data.arg2()); |
116 } | 116 } |
117 | 117 |
118 } // namespace settings | 118 } // namespace settings |
OLD | NEW |