| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf_layout_manager.h" | 8 #include "ash/shelf/shelf_layout_manager.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // Show the system tray menu using the provided event generator. | 40 // Show the system tray menu using the provided event generator. |
| 41 void ShowTrayMenu(ui::test::EventGenerator* generator); | 41 void ShowTrayMenu(ui::test::EventGenerator* generator); |
| 42 | 42 |
| 43 // Move the mouse over the user item. | 43 // Move the mouse over the user item. |
| 44 void MoveOverUserItem(ui::test::EventGenerator* generator, int index); | 44 void MoveOverUserItem(ui::test::EventGenerator* generator, int index); |
| 45 | 45 |
| 46 // Click on the user item. Note that the tray menu needs to be shown. | 46 // Click on the user item. Note that the tray menu needs to be shown. |
| 47 void ClickUserItem(ui::test::EventGenerator* generator, int index); | 47 void ClickUserItem(ui::test::EventGenerator* generator, int index); |
| 48 | 48 |
| 49 // Accessors to various system components. | 49 // Accessors to various system components. |
| 50 ShelfLayoutManager* shelf() { return shelf_; } | |
| 51 SystemTray* tray() { return tray_; } | 50 SystemTray* tray() { return tray_; } |
| 52 ash::test::TestSessionStateDelegate* delegate() { return delegate_; } | 51 ash::test::TestSessionStateDelegate* delegate() { return delegate_; } |
| 53 ash::TrayUser* tray_user(int index) { return tray_user_[index]; } | 52 ash::TrayUser* tray_user(int index) { return tray_user_[index]; } |
| 54 ash::TrayUserSeparator* tray_user_separator() { return tray_user_separator_; } | 53 ash::TrayUserSeparator* tray_user_separator() { return tray_user_separator_; } |
| 55 | 54 |
| 56 private: | 55 private: |
| 57 ShelfLayoutManager* shelf_; | |
| 58 SystemTray* tray_; | 56 SystemTray* tray_; |
| 59 ash::test::TestSessionStateDelegate* delegate_; | 57 ash::test::TestSessionStateDelegate* delegate_; |
| 60 | 58 |
| 61 // Note that the ownership of these items is on the shelf. | 59 // Note that the ownership of these items is on the shelf. |
| 62 std::vector<ash::TrayUser*> tray_user_; | 60 std::vector<ash::TrayUser*> tray_user_; |
| 63 | 61 |
| 64 // The separator between the tray users and the rest of the menu. | 62 // The separator between the tray users and the rest of the menu. |
| 65 // Note: The item will get owned by the shelf. | 63 // Note: The item will get owned by the shelf. |
| 66 TrayUserSeparator* tray_user_separator_; | 64 TrayUserSeparator* tray_user_separator_; |
| 67 | 65 |
| 68 DISALLOW_COPY_AND_ASSIGN(TrayUserTest); | 66 DISALLOW_COPY_AND_ASSIGN(TrayUserTest); |
| 69 }; | 67 }; |
| 70 | 68 |
| 71 TrayUserTest::TrayUserTest() | 69 TrayUserTest::TrayUserTest() |
| 72 : shelf_(NULL), | 70 : tray_(nullptr), delegate_(nullptr), tray_user_separator_(nullptr) {} |
| 73 tray_(NULL), | |
| 74 delegate_(NULL), | |
| 75 tray_user_separator_(NULL) { | |
| 76 } | |
| 77 | 71 |
| 78 void TrayUserTest::SetUp() { | 72 void TrayUserTest::SetUp() { |
| 79 ash::test::AshTestBase::SetUp(); | 73 ash::test::AshTestBase::SetUp(); |
| 80 shelf_ = Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | |
| 81 tray_ = Shell::GetPrimaryRootWindowController()->GetSystemTray(); | 74 tray_ = Shell::GetPrimaryRootWindowController()->GetSystemTray(); |
| 82 delegate_ = static_cast<ash::test::TestSessionStateDelegate*>( | 75 delegate_ = static_cast<ash::test::TestSessionStateDelegate*>( |
| 83 ash::Shell::GetInstance()->session_state_delegate()); | 76 ash::Shell::GetInstance()->session_state_delegate()); |
| 84 } | 77 } |
| 85 | 78 |
| 86 void TrayUserTest::InitializeParameters(int users_logged_in, | 79 void TrayUserTest::InitializeParameters(int users_logged_in, |
| 87 bool multiprofile) { | 80 bool multiprofile) { |
| 88 // Show the shelf. | 81 // Show the shelf. |
| 89 shelf()->LayoutShelf(); | 82 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 90 shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 83 shelf->shelf_layout_manager()->LayoutShelf(); |
| 84 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 91 | 85 |
| 92 // Set our default assumptions. Note that it is sufficient to set these | 86 // Set our default assumptions. Note that it is sufficient to set these |
| 93 // after everything was created. | 87 // after everything was created. |
| 94 delegate_->set_logged_in_users(users_logged_in); | 88 delegate_->set_logged_in_users(users_logged_in); |
| 95 ash::test::TestShellDelegate* shell_delegate = | 89 ash::test::TestShellDelegate* shell_delegate = |
| 96 static_cast<ash::test::TestShellDelegate*>( | 90 static_cast<ash::test::TestShellDelegate*>( |
| 97 ash::Shell::GetInstance()->delegate()); | 91 ash::Shell::GetInstance()->delegate()); |
| 98 shell_delegate->set_multi_profiles_enabled(multiprofile); | 92 shell_delegate->set_multi_profiles_enabled(multiprofile); |
| 99 | 93 |
| 100 // Instead of using the existing tray panels we create new ones which makes | 94 // Instead of using the existing tray panels we create new ones which makes |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 // Since the name is capitalized, the email should be different then the | 271 // Since the name is capitalized, the email should be different then the |
| 278 // user_id. | 272 // user_id. |
| 279 EXPECT_NE(active_user->GetAccountId().GetUserEmail(), | 273 EXPECT_NE(active_user->GetAccountId().GetUserEmail(), |
| 280 second_user->GetEmail()); | 274 second_user->GetEmail()); |
| 281 tray()->CloseSystemBubble(); | 275 tray()->CloseSystemBubble(); |
| 282 } | 276 } |
| 283 | 277 |
| 284 #endif | 278 #endif |
| 285 | 279 |
| 286 } // namespace ash | 280 } // namespace ash |
| OLD | NEW |