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_; } | 50 ShelfLayoutManager* shelf_layout_manager() { return shelf_layout_manager_; } |
51 SystemTray* tray() { return tray_; } | 51 SystemTray* tray() { return tray_; } |
52 ash::test::TestSessionStateDelegate* delegate() { return delegate_; } | 52 ash::test::TestSessionStateDelegate* delegate() { return delegate_; } |
53 ash::TrayUser* tray_user(int index) { return tray_user_[index]; } | 53 ash::TrayUser* tray_user(int index) { return tray_user_[index]; } |
54 ash::TrayUserSeparator* tray_user_separator() { return tray_user_separator_; } | 54 ash::TrayUserSeparator* tray_user_separator() { return tray_user_separator_; } |
55 | 55 |
56 private: | 56 private: |
57 ShelfLayoutManager* shelf_; | 57 ShelfLayoutManager* shelf_layout_manager_; |
msw
2016/06/01 00:53:24
nit: remove member altogether; it's only used once
James Cook
2016/06/01 15:53:06
Done.
| |
58 SystemTray* tray_; | 58 SystemTray* tray_; |
59 ash::test::TestSessionStateDelegate* delegate_; | 59 ash::test::TestSessionStateDelegate* delegate_; |
60 | 60 |
61 // Note that the ownership of these items is on the shelf. | 61 // Note that the ownership of these items is on the shelf. |
62 std::vector<ash::TrayUser*> tray_user_; | 62 std::vector<ash::TrayUser*> tray_user_; |
63 | 63 |
64 // The separator between the tray users and the rest of the menu. | 64 // The separator between the tray users and the rest of the menu. |
65 // Note: The item will get owned by the shelf. | 65 // Note: The item will get owned by the shelf. |
66 TrayUserSeparator* tray_user_separator_; | 66 TrayUserSeparator* tray_user_separator_; |
67 | 67 |
68 DISALLOW_COPY_AND_ASSIGN(TrayUserTest); | 68 DISALLOW_COPY_AND_ASSIGN(TrayUserTest); |
69 }; | 69 }; |
70 | 70 |
71 TrayUserTest::TrayUserTest() | 71 TrayUserTest::TrayUserTest() |
72 : shelf_(NULL), | 72 : shelf_layout_manager_(nullptr), |
73 tray_(NULL), | 73 tray_(nullptr), |
74 delegate_(NULL), | 74 delegate_(nullptr), |
75 tray_user_separator_(NULL) { | 75 tray_user_separator_(nullptr) {} |
76 } | |
77 | 76 |
78 void TrayUserTest::SetUp() { | 77 void TrayUserTest::SetUp() { |
79 ash::test::AshTestBase::SetUp(); | 78 ash::test::AshTestBase::SetUp(); |
80 shelf_ = Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | 79 shelf_layout_manager_ = |
80 Shell::GetPrimaryRootWindowController()->GetShelfLayoutManager(); | |
81 tray_ = Shell::GetPrimaryRootWindowController()->GetSystemTray(); | 81 tray_ = Shell::GetPrimaryRootWindowController()->GetSystemTray(); |
82 delegate_ = static_cast<ash::test::TestSessionStateDelegate*>( | 82 delegate_ = static_cast<ash::test::TestSessionStateDelegate*>( |
83 ash::Shell::GetInstance()->session_state_delegate()); | 83 ash::Shell::GetInstance()->session_state_delegate()); |
84 } | 84 } |
85 | 85 |
86 void TrayUserTest::InitializeParameters(int users_logged_in, | 86 void TrayUserTest::InitializeParameters(int users_logged_in, |
87 bool multiprofile) { | 87 bool multiprofile) { |
88 // Show the shelf. | 88 // Show the shelf. |
89 shelf()->LayoutShelf(); | 89 shelf_layout_manager()->LayoutShelf(); |
90 shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 90 Shelf::ForPrimaryDisplay()->SetAutoHideBehavior( |
91 SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | |
91 | 92 |
92 // Set our default assumptions. Note that it is sufficient to set these | 93 // Set our default assumptions. Note that it is sufficient to set these |
93 // after everything was created. | 94 // after everything was created. |
94 delegate_->set_logged_in_users(users_logged_in); | 95 delegate_->set_logged_in_users(users_logged_in); |
95 ash::test::TestShellDelegate* shell_delegate = | 96 ash::test::TestShellDelegate* shell_delegate = |
96 static_cast<ash::test::TestShellDelegate*>( | 97 static_cast<ash::test::TestShellDelegate*>( |
97 ash::Shell::GetInstance()->delegate()); | 98 ash::Shell::GetInstance()->delegate()); |
98 shell_delegate->set_multi_profiles_enabled(multiprofile); | 99 shell_delegate->set_multi_profiles_enabled(multiprofile); |
99 | 100 |
100 // Instead of using the existing tray panels we create new ones which makes | 101 // 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 | 278 // Since the name is capitalized, the email should be different then the |
278 // user_id. | 279 // user_id. |
279 EXPECT_NE(active_user->GetAccountId().GetUserEmail(), | 280 EXPECT_NE(active_user->GetAccountId().GetUserEmail(), |
280 second_user->GetEmail()); | 281 second_user->GetEmail()); |
281 tray()->CloseSystemBubble(); | 282 tray()->CloseSystemBubble(); |
282 } | 283 } |
283 | 284 |
284 #endif | 285 #endif |
285 | 286 |
286 } // namespace ash | 287 } // namespace ash |
OLD | NEW |