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

Side by Side Diff: chrome/browser/chromeos/login/ui/user_adding_screen_browsertest.cc

Issue 290083005: Added test checking that m-p user adding UI is visible after show. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge conflicts resolved. Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 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 "ash/session/session_state_delegate.h" 5 #include "ash/session/session_state_delegate.h"
6 #include "ash/shell.h" 6 #include "ash/shell.h"
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/chromeos/login/lock/screen_locker.h"
10 #include "chrome/browser/chromeos/login/lock/screen_locker_tester.h"
8 #include "chrome/browser/chromeos/login/login_manager_test.h" 11 #include "chrome/browser/chromeos/login/login_manager_test.h"
9 #include "chrome/browser/chromeos/login/startup_utils.h" 12 #include "chrome/browser/chromeos/login/startup_utils.h"
10 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" 13 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h"
11 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h" 14 #include "chrome/browser/chromeos/login/ui/user_adding_screen.h"
15 #include "chrome/browser/chromeos/login/ui/webui_login_view.h"
12 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h" 16 #include "chrome/browser/chromeos/login/users/multi_profile_user_controller.h"
13 #include "chrome/browser/chromeos/login/users/user_manager.h" 17 #include "chrome/browser/chromeos/login/users/user_manager.h"
14 #include "chrome/common/chrome_switches.h" 18 #include "chrome/common/chrome_switches.h"
15 #include "chrome/common/pref_names.h" 19 #include "chrome/common/pref_names.h"
16 #include "chrome/test/base/in_process_browser_test.h" 20 #include "chrome/test/base/in_process_browser_test.h"
17 #include "content/public/test/test_utils.h" 21 #include "content/public/test/test_utils.h"
18 #include "testing/gtest/include/gtest/gtest.h" 22 #include "testing/gtest/include/gtest/gtest.h"
19 23
20 using namespace testing; 24 using namespace testing;
21 25
(...skipping 26 matching lines...) Expand all
48 } 52 }
49 53
50 virtual void OnUserAddingFinished() OVERRIDE { ++user_adding_finished_; } 54 virtual void OnUserAddingFinished() OVERRIDE { ++user_adding_finished_; }
51 55
52 virtual void OnUserAddingStarted() OVERRIDE { ++user_adding_started_; } 56 virtual void OnUserAddingStarted() OVERRIDE { ++user_adding_started_; }
53 57
54 void SetUserCanLock(User* user, bool can_lock) { 58 void SetUserCanLock(User* user, bool can_lock) {
55 user->set_can_lock(can_lock); 59 user->set_can_lock(can_lock);
56 } 60 }
57 61
62 void CheckScreenIsVisible() {
63 views::View* web_view =
64 LoginDisplayHostImpl::default_host()->GetWebUILoginView()->child_at(0);
65 for (views::View* current_view = web_view;
66 current_view;
67 current_view = current_view->parent()) {
68 EXPECT_TRUE(current_view->visible());
69 if (current_view->layer())
70 EXPECT_EQ(current_view->layer()->GetCombinedOpacity(), 1.f);
71 }
72 for (aura::Window* window = web_view->GetWidget()->GetNativeWindow();
73 window;
74 window = window->parent()) {
75 EXPECT_TRUE(window->IsVisible());
76 EXPECT_EQ(window->layer()->GetCombinedOpacity(), 1.f);
77 }
78 }
79
58 int user_adding_started() { return user_adding_started_; } 80 int user_adding_started() { return user_adding_started_; }
59 81
60 int user_adding_finished() { return user_adding_finished_; } 82 int user_adding_finished() { return user_adding_finished_; }
61 83
62 private: 84 private:
63 int user_adding_started_; 85 int user_adding_started_;
64 int user_adding_finished_; 86 int user_adding_finished_;
65 87
66 DISALLOW_COPY_AND_ASSIGN(UserAddingScreenTest); 88 DISALLOW_COPY_AND_ASSIGN(UserAddingScreenTest);
67 }; 89 };
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 // if that user happened to still be part of multi-profile session it should 228 // if that user happened to still be part of multi-profile session it should
207 // not be listed on screen lock. 229 // not be listed on screen lock.
208 prefs3->SetString(prefs::kMultiProfileUserBehavior, 230 prefs3->SetString(prefs::kMultiProfileUserBehavior,
209 MultiProfileUserController::kBehaviorNotAllowed); 231 MultiProfileUserController::kBehaviorNotAllowed);
210 unlock_users = user_manager->GetUnlockUsers(); 232 unlock_users = user_manager->GetUnlockUsers();
211 ASSERT_EQ(2UL, unlock_users.size()); 233 ASSERT_EQ(2UL, unlock_users.size());
212 for (int i = 0; i < 2; ++i) 234 for (int i = 0; i < 2; ++i)
213 EXPECT_EQ(kTestUsers[i], unlock_users[i]->email()); 235 EXPECT_EQ(kTestUsers[i], unlock_users[i]->email());
214 } 236 }
215 237
238 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_ScreenVisibility) {
239 RegisterUser(kTestUsers[0]);
240 RegisterUser(kTestUsers[1]);
241 StartupUtils::MarkOobeCompleted();
242 }
243
244 // Trying to catch http://crbug.com/362153.
245 IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, ScreenVisibility) {
246 LoginUser(kTestUsers[0]);
247
248 UserAddingScreen::Get()->Start();
249 content::RunAllPendingInMessageLoop();
250 CheckScreenIsVisible();
251 UserAddingScreen::Get()->Cancel();
252 content::RunAllPendingInMessageLoop();
253
254 ScreenLocker::Show();
255 content::WindowedNotificationObserver(
256 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
257 content::NotificationService::AllSources()).Wait();
258
259 ScreenLocker::Hide();
260 content::WindowedNotificationObserver(
261 chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
262 content::NotificationService::AllSources()).Wait();
263
264 UserAddingScreen::Get()->Start();
265 content::RunAllPendingInMessageLoop();
266 CheckScreenIsVisible();
267 UserAddingScreen::Get()->Cancel();
268 content::RunAllPendingInMessageLoop();
269 }
270
216 } // namespace chromeos 271 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698