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 "ash/common/system/tray/tray_details_view.h" | 5 #include "ash/common/system/tray/tray_details_view.h" |
6 | 6 |
7 #include "ash/common/ash_view_ids.h" | 7 #include "ash/common/ash_view_ids.h" |
8 #include "ash/common/system/tray/hover_highlight_view.h" | 8 #include "ash/common/system/tray/hover_highlight_view.h" |
9 #include "ash/common/system/tray/special_popup_row.h" | 9 #include "ash/common/system/tray/special_popup_row.h" |
10 #include "ash/common/system/tray/system_tray.h" | 10 #include "ash/common/system/tray/system_tray.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 tray->ShowDefaultView(BUBBLE_CREATE_NEW); | 119 tray->ShowDefaultView(BUBBLE_CREATE_NEW); |
120 RunAllPendingInMessageLoop(); | 120 RunAllPendingInMessageLoop(); |
121 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); | 121 tray->ShowDetailedView(test_item, 0, true, BUBBLE_USE_EXISTING); |
122 RunAllPendingInMessageLoop(); | 122 RunAllPendingInMessageLoop(); |
123 | 123 |
124 return test_item->detailed_view()->tray_popup_header_button(); | 124 return test_item->detailed_view()->tray_popup_header_button(); |
125 } | 125 } |
126 | 126 |
127 void TransitionFromDetailedToDefaultView(TestDetailsView* detailed) { | 127 void TransitionFromDetailedToDefaultView(TestDetailsView* detailed) { |
128 detailed->TransitionToDefaultView(); | 128 detailed->TransitionToDefaultView(); |
129 scoped_task_runner_->FastForwardBy( | 129 (*scoped_task_runner_) |
130 base::TimeDelta::FromMilliseconds(kTrayDetailedViewTransitionDelayMs)); | 130 ->FastForwardBy(base::TimeDelta::FromMilliseconds( |
| 131 kTrayDetailedViewTransitionDelayMs)); |
131 } | 132 } |
132 | 133 |
133 void FocusBackButton(TestDetailsView* detailed) { | 134 void FocusBackButton(TestDetailsView* detailed) { |
134 detailed->back_button_->RequestFocus(); | 135 detailed->back_button_->RequestFocus(); |
135 } | 136 } |
136 | 137 |
| 138 void SetUp() override { |
| 139 AshTestBase::SetUp(); |
| 140 scoped_task_runner_ = |
| 141 base::MakeUnique<base::ScopedMockTimeMessageLoopTaskRunner>(); |
| 142 } |
| 143 |
| 144 void TearDown() override { |
| 145 scoped_task_runner_.reset(); |
| 146 AshTestBase::TearDown(); |
| 147 } |
| 148 |
137 private: | 149 private: |
138 // Used to control the |transition_delay_timer_|. | 150 // Used to control the |transition_delay_timer_|. |
139 base::ScopedMockTimeMessageLoopTaskRunner scoped_task_runner_; | 151 std::unique_ptr<base::ScopedMockTimeMessageLoopTaskRunner> |
| 152 scoped_task_runner_; |
140 | 153 |
141 DISALLOW_COPY_AND_ASSIGN(TrayDetailsViewTest); | 154 DISALLOW_COPY_AND_ASSIGN(TrayDetailsViewTest); |
142 }; | 155 }; |
143 | 156 |
144 TEST_F(TrayDetailsViewTest, TransitionToDefaultViewTest) { | 157 TEST_F(TrayDetailsViewTest, TransitionToDefaultViewTest) { |
145 SystemTray* tray = GetPrimarySystemTray(); | 158 SystemTray* tray = GetPrimarySystemTray(); |
146 ASSERT_TRUE(tray->GetWidget()); | 159 ASSERT_TRUE(tray->GetWidget()); |
147 | 160 |
148 TestItem* test_item_1 = new TestItem; | 161 TestItem* test_item_1 = new TestItem; |
149 TestItem* test_item_2 = new TestItem; | 162 TestItem* test_item_2 = new TestItem; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 239 |
227 // Sticky header layer should be above the last child's layer. | 240 // Sticky header layer should be above the last child's layer. |
228 EXPECT_EQ(3u, layers.size()); | 241 EXPECT_EQ(3u, layers.size()); |
229 EXPECT_EQ(view3->layer(), layers[0]); | 242 EXPECT_EQ(view3->layer(), layers[0]); |
230 EXPECT_EQ(view4->layer(), layers[1]); | 243 EXPECT_EQ(view4->layer(), layers[1]); |
231 EXPECT_EQ(view2->layer(), layers[2]); | 244 EXPECT_EQ(view2->layer(), layers[2]); |
232 } | 245 } |
233 | 246 |
234 } // namespace test | 247 } // namespace test |
235 } // namespace ash | 248 } // namespace ash |
OLD | NEW |