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

Side by Side Diff: chrome/browser/ui/webui/settings/profile_info_handler_unittest.cc

Issue 2807373003: MD Settings: get the avatar icon the same way the user switcher does (Closed)
Patch Set: fix tests Created 3 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
« no previous file with comments | « chrome/browser/ui/webui/settings/profile_info_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/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"
11 #include "chrome/test/base/testing_profile.h" 11 #include "chrome/test/base/testing_profile.h"
12 #include "chrome/test/base/testing_profile_manager.h" 12 #include "chrome/test/base/testing_profile_manager.h"
13 #include "components/prefs/scoped_user_pref_update.h" 13 #include "components/prefs/scoped_user_pref_update.h"
14 #include "content/public/browser/web_ui_data_source.h" 14 #include "content/public/browser/web_ui_data_source.h"
15 #include "content/public/test/test_browser_thread_bundle.h" 15 #include "content/public/test/test_browser_thread_bundle.h"
16 #include "content/public/test/test_web_ui.h" 16 #include "content/public/test/test_web_ui.h"
17 #include "net/base/data_url.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include "url/gurl.h"
18 20
19 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
20 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 22 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
21 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 23 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
22 #endif 24 #endif
23 25
24 namespace settings { 26 namespace settings {
25 27
26 namespace { 28 namespace {
27 29
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 std::string name; 73 std::string name;
72 std::string icon_url; 74 std::string icon_url;
73 ASSERT_TRUE(response->GetString("name", &name)); 75 ASSERT_TRUE(response->GetString("name", &name));
74 ASSERT_TRUE(response->GetString("iconUrl", &icon_url)); 76 ASSERT_TRUE(response->GetString("iconUrl", &icon_url));
75 77
76 #if defined(OS_CHROMEOS) 78 #if defined(OS_CHROMEOS)
77 EXPECT_EQ(fake_id, name); 79 EXPECT_EQ(fake_id, name);
78 EXPECT_FALSE(icon_url.empty()); 80 EXPECT_FALSE(icon_url.empty());
79 #else 81 #else
80 EXPECT_EQ("Profile 1", name); 82 EXPECT_EQ("Profile 1", name);
81 EXPECT_EQ("chrome://theme/IDR_PROFILE_AVATAR_0", icon_url); 83 std::string mime, charset, data; // All unused.
84 EXPECT_TRUE(net::DataURL::Parse(GURL(icon_url), &mime, &charset, &data));
dschuyler 2017/04/11 23:36:48 How about something like the tests done here that
Dan Beam 2017/04/11 23:50:32 Done.
82 #endif 85 #endif
83 } 86 }
84 87
85 content::TestWebUI* web_ui() { return &web_ui_; } 88 content::TestWebUI* web_ui() { return &web_ui_; }
86 Profile* profile() const { return profile_; } 89 Profile* profile() const { return profile_; }
87 TestProfileInfoHandler* handler() const { return handler_.get(); } 90 TestProfileInfoHandler* handler() const { return handler_.get(); }
88 91
89 private: 92 private:
90 content::TestBrowserThreadBundle thread_bundle_; 93 content::TestBrowserThreadBundle thread_bundle_;
91 TestingProfileManager profile_manager_; 94 TestingProfileManager profile_manager_;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 ASSERT_TRUE(data.arg1()->GetAsString(&event_id)); 183 ASSERT_TRUE(data.arg1()->GetAsString(&event_id));
181 EXPECT_EQ(ProfileInfoHandler::kProfileManagesSupervisedUsersChangedEventName, 184 EXPECT_EQ(ProfileInfoHandler::kProfileManagesSupervisedUsersChangedEventName,
182 event_id); 185 event_id);
183 186
184 bool has_supervised_users = false; 187 bool has_supervised_users = false;
185 ASSERT_TRUE(data.arg2()->GetAsBoolean(&has_supervised_users)); 188 ASSERT_TRUE(data.arg2()->GetAsBoolean(&has_supervised_users));
186 EXPECT_TRUE(has_supervised_users); 189 EXPECT_TRUE(has_supervised_users);
187 } 190 }
188 191
189 } // namespace settings 192 } // namespace settings
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/settings/profile_info_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698