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

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

Issue 2381753002: Use mojo SystemTray interfaces for both mash and classic ash (Closed)
Patch Set: rebase again Created 4 years, 2 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
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/common/system/date/date_default_view.h" 9 #include "ash/common/system/date/date_default_view.h"
10 #include "ash/common/system/date/date_view.h" 10 #include "ash/common/system/date/date_view.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 account_id1_(AccountId::FromUserEmail(kUser1)), 84 account_id1_(AccountId::FromUserEmail(kUser1)),
85 account_id2_(AccountId::FromUserEmail(kUser2)) {} 85 account_id2_(AccountId::FromUserEmail(kUser2)) {}
86 86
87 ~SystemTrayDelegateChromeOSTest() override {} 87 ~SystemTrayDelegateChromeOSTest() override {}
88 88
89 void SetupUserProfile(const AccountId& account_id, bool use_24_hour_clock) { 89 void SetupUserProfile(const AccountId& account_id, bool use_24_hour_clock) {
90 const user_manager::User* user = 90 const user_manager::User* user =
91 user_manager::UserManager::Get()->FindUser(account_id); 91 user_manager::UserManager::Get()->FindUser(account_id);
92 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); 92 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user);
93 profile->GetPrefs()->SetBoolean(prefs::kUse24HourClock, use_24_hour_clock); 93 profile->GetPrefs()->SetBoolean(prefs::kUse24HourClock, use_24_hour_clock);
94 // Allow clock setting to be sent to ash over mojo.
95 content::RunAllPendingInMessageLoop();
94 } 96 }
95 97
96 const AccountId account_id1_; 98 const AccountId account_id1_;
97 const AccountId account_id2_; 99 const AccountId account_id2_;
98 100
99 private: 101 private:
100 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOSTest); 102 DISALLOW_COPY_AND_ASSIGN(SystemTrayDelegateChromeOSTest);
101 }; 103 };
102 104
103 IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest, 105 IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest,
104 PRE_TestMultiProfile24HourClock) { 106 PRE_TestMultiProfile24HourClock) {
105 RegisterUser(account_id1_.GetUserEmail()); 107 RegisterUser(account_id1_.GetUserEmail());
106 RegisterUser(account_id2_.GetUserEmail()); 108 RegisterUser(account_id2_.GetUserEmail());
107 StartupUtils::MarkOobeCompleted(); 109 StartupUtils::MarkOobeCompleted();
108 } 110 }
109 111
110 // Test that clock type is taken from user profile for current active user. 112 // Test that clock type is taken from user profile for current active user.
111 IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest, 113 IN_PROC_BROWSER_TEST_F(SystemTrayDelegateChromeOSTest,
112 TestMultiProfile24HourClock) { 114 TestMultiProfile24HourClock) {
113 LoginUser(account_id1_.GetUserEmail()); 115 LoginUser(account_id1_.GetUserEmail());
114 SetupUserProfile(account_id1_, true /* Use_24_hour_clock. */); 116 SetupUserProfile(account_id1_, true /* Use_24_hour_clock. */);
115 CreateDefaultView(); 117 CreateDefaultView();
116 EXPECT_EQ(base::k24HourClock, GetHourType()); 118 EXPECT_EQ(base::k24HourClock, GetHourType());
119
117 UserAddingScreen::Get()->Start(); 120 UserAddingScreen::Get()->Start();
118 content::RunAllPendingInMessageLoop(); 121 content::RunAllPendingInMessageLoop();
119 AddUser(account_id2_.GetUserEmail()); 122 AddUser(account_id2_.GetUserEmail());
120 SetupUserProfile(account_id2_, false /* Use_24_hour_clock. */); 123 SetupUserProfile(account_id2_, false /* Use_24_hour_clock. */);
121 CreateDefaultView(); 124 CreateDefaultView();
122 EXPECT_EQ(base::k12HourClock, GetHourType()); 125 EXPECT_EQ(base::k12HourClock, GetHourType());
126
123 user_manager::UserManager::Get()->SwitchActiveUser(account_id1_); 127 user_manager::UserManager::Get()->SwitchActiveUser(account_id1_);
128 // Allow clock setting to be sent to ash over mojo.
129 content::RunAllPendingInMessageLoop();
124 CreateDefaultView(); 130 CreateDefaultView();
125 EXPECT_EQ(base::k24HourClock, GetHourType()); 131 EXPECT_EQ(base::k24HourClock, GetHourType());
126 } 132 }
127 133
128 // Makes sure that no notifications are shown when rotating the 134 // Makes sure that no notifications are shown when rotating the
129 // display on display settings URLs. 135 // display on display settings URLs.
130 IN_PROC_BROWSER_TEST_F(DisplayNotificationsTest, 136 IN_PROC_BROWSER_TEST_F(DisplayNotificationsTest,
131 TestDisplayOrientationChangeNotification) { 137 TestDisplayOrientationChangeNotification) {
132 // Open the display settings page. 138 // Open the display settings page.
133 ui_test_utils::NavigateToURL(browser(), 139 ui_test_utils::NavigateToURL(browser(),
(...skipping 19 matching lines...) Expand all
153 159
154 UpdateDisplay("400x400"); 160 UpdateDisplay("400x400");
155 161
156 ui_test_utils::NavigateToURL(browser(), GURL("chrome://version")); 162 ui_test_utils::NavigateToURL(browser(), GURL("chrome://version"));
157 UpdateDisplay("400x400/r"); 163 UpdateDisplay("400x400/r");
158 // Ensure that there is a notification that is shown. 164 // Ensure that there is a notification that is shown.
159 EXPECT_FALSE(GetVisibleNotifications().empty()); 165 EXPECT_FALSE(GetVisibleNotifications().empty());
160 } 166 }
161 167
162 } // namespace chromeos 168 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698