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

Side by Side Diff: chrome/browser/ui/ash/system_tray_delegate_chromeos_browsertest_chromeos.cc

Issue 1412813003: This CL replaces user_manager::UserID with AccountId. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@468875--Chrome-OS-handles-deletion-of-Gmail-account-poorly--Create-AccountID-structure-part2--user_names
Patch Set: Fix Win GN build. Created 5 years, 1 month 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ash/system_tray_delegate_chromeos.h" 5 #include "chrome/browser/ui/ash/system_tray_delegate_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/display/display_manager.h" 9 #include "ash/display/display_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 72
73 message_center::NotificationList::Notifications GetVisibleNotifications() 73 message_center::NotificationList::Notifications GetVisibleNotifications()
74 const { 74 const {
75 return message_center::MessageCenter::Get()->GetVisibleNotifications(); 75 return message_center::MessageCenter::Get()->GetVisibleNotifications();
76 } 76 }
77 }; 77 };
78 78
79 class SystemTrayDelegateChromeOSTest : public LoginManagerTest { 79 class SystemTrayDelegateChromeOSTest : public LoginManagerTest {
80 protected: 80 protected:
81 SystemTrayDelegateChromeOSTest() 81 SystemTrayDelegateChromeOSTest()
82 : LoginManagerTest(false /* should_launch_browser */) {} 82 : LoginManagerTest(false /* should_launch_browser */),
83 account_id1_(AccountId::FromUserEmail(kUser1)),
84 account_id2_(AccountId::FromUserEmail(kUser2)) {}
83 85
84 ~SystemTrayDelegateChromeOSTest() override {} 86 ~SystemTrayDelegateChromeOSTest() override {}
85 87
86 void SetupUserProfile(const std::string& user_name, bool use_24_hour_clock) { 88 void SetupUserProfile(const AccountId& account_id, bool use_24_hour_clock) {
87 const user_manager::User* user = 89 const user_manager::User* user =
88 user_manager::UserManager::Get()->FindUser(user_name); 90 user_manager::UserManager::Get()->FindUser(account_id);
89 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); 91 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user);
90 profile->GetPrefs()->SetBoolean(prefs::kUse24HourClock, use_24_hour_clock); 92 profile->GetPrefs()->SetBoolean(prefs::kUse24HourClock, use_24_hour_clock);
91 } 93 }
92 94
95 const AccountId account_id1_;
96 const AccountId account_id2_;
97
93 private: 98 private:
94 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOSTest); 99 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOSTest);
95 }; 100 };
96 101
97 IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest, 102 IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest,
98 PRE_TestMultiProfile24HourClock) { 103 PRE_TestMultiProfile24HourClock) {
99 RegisterUser(kUser1); 104 RegisterUser(account_id1_.GetUserEmail());
100 RegisterUser(kUser2); 105 RegisterUser(account_id2_.GetUserEmail());
101 StartupUtils::MarkOobeCompleted(); 106 StartupUtils::MarkOobeCompleted();
102 } 107 }
103 108
104 // Test that clock type is taken from user profile for current active user. 109 // Test that clock type is taken from user profile for current active user.
105 IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest, 110 IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest,
106 TestMultiProfile24HourClock) { 111 TestMultiProfile24HourClock) {
107 LoginUser(kUser1); 112 LoginUser(account_id1_.GetUserEmail());
108 SetupUserProfile(kUser1, true /* Use_24_hour_clock. */); 113 SetupUserProfile(account_id1_, true /* Use_24_hour_clock. */);
109 CreateDefaultView(); 114 CreateDefaultView();
110 EXPECT_EQ(base::k24HourClock, GetHourType()); 115 EXPECT_EQ(base::k24HourClock, GetHourType());
111 UserAddingScreen::Get()->Start(); 116 UserAddingScreen::Get()->Start();
112 content::RunAllPendingInMessageLoop(); 117 content::RunAllPendingInMessageLoop();
113 AddUser(kUser2); 118 AddUser(account_id2_.GetUserEmail());
114 SetupUserProfile(kUser2, false /* Use_24_hour_clock. */); 119 SetupUserProfile(account_id2_, false /* Use_24_hour_clock. */);
115 CreateDefaultView(); 120 CreateDefaultView();
116 EXPECT_EQ(base::k12HourClock, GetHourType()); 121 EXPECT_EQ(base::k12HourClock, GetHourType());
117 user_manager::UserManager::Get()->SwitchActiveUser(kUser1); 122 user_manager::UserManager::Get()->SwitchActiveUser(account_id1_);
118 CreateDefaultView(); 123 CreateDefaultView();
119 EXPECT_EQ(base::k24HourClock, GetHourType()); 124 EXPECT_EQ(base::k24HourClock, GetHourType());
120 } 125 }
121 126
122 // Makes sure that no notifications are shown when rotating the 127 // Makes sure that no notifications are shown when rotating the
123 // display on display settings URLs. 128 // display on display settings URLs.
124 IN_PROC_BROWSER_TEST_F(DisplayNotificationsTest, 129 IN_PROC_BROWSER_TEST_F(DisplayNotificationsTest,
125 TestDisplayOrientationChangeNotification) { 130 TestDisplayOrientationChangeNotification) {
126 // Open the display settings page. 131 // Open the display settings page.
127 ui_test_utils::NavigateToURL(browser(), 132 ui_test_utils::NavigateToURL(browser(),
(...skipping 19 matching lines...) Expand all
147 152
148 UpdateDisplay("400x400"); 153 UpdateDisplay("400x400");
149 154
150 ui_test_utils::NavigateToURL(browser(), GURL("chrome://version")); 155 ui_test_utils::NavigateToURL(browser(), GURL("chrome://version"));
151 UpdateDisplay("400x400/r"); 156 UpdateDisplay("400x400/r");
152 // Ensure that there is a notification that is shown. 157 // Ensure that there is a notification that is shown.
153 EXPECT_FALSE(GetVisibleNotifications().empty()); 158 EXPECT_FALSE(GetVisibleNotifications().empty());
154 } 159 }
155 160
156 } // namespace chromeos 161 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/system_tray_delegate_chromeos.cc ('k') | chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698