OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/views/ash/tab_scrubber.h" | 5 #include "chrome/browser/ui/views/ash/tab_scrubber.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "ash/display/event_transformation_handler.h" | 9 #include "ash/display/event_transformation_handler.h" |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 void SendScrubSequence(Browser* browser, float x_offset, int index) { | 174 void SendScrubSequence(Browser* browser, float x_offset, int index) { |
175 aura::Window* window = browser->window()->GetNativeWindow(); | 175 aura::Window* window = browser->window()->GetNativeWindow(); |
176 aura::Window* root = window->GetRootWindow(); | 176 aura::Window* root = window->GetRootWindow(); |
177 ui::test::EventGenerator event_generator(root, window); | 177 ui::test::EventGenerator event_generator(root, window); |
178 bool wait_for_active = false; | 178 bool wait_for_active = false; |
179 if (index != browser->tab_strip_model()->active_index()) { | 179 if (index != browser->tab_strip_model()->active_index()) { |
180 wait_for_active = true; | 180 wait_for_active = true; |
181 event_generator.set_async(true); | 181 event_generator.set_async(true); |
182 } | 182 } |
183 event_generator.ScrollSequence(gfx::Point(0, 0), | 183 event_generator.ScrollSequence(gfx::Point(0, 0), |
184 ui::EventTimeForNow(), | 184 base::TimeDelta::FromMilliseconds(100), |
185 x_offset, | 185 x_offset, 0, 1, 3); |
186 0, | |
187 1, | |
188 3); | |
189 if (wait_for_active) | 186 if (wait_for_active) |
190 RunUntilTabActive(browser, index); | 187 RunUntilTabActive(browser, index); |
191 } | 188 } |
192 | 189 |
193 void AddTabs(Browser* browser, int num_tabs) { | 190 void AddTabs(Browser* browser, int num_tabs) { |
194 TabStrip* tab_strip = GetTabStrip(browser); | 191 TabStrip* tab_strip = GetTabStrip(browser); |
195 for (int i = 0; i < num_tabs; ++i) | 192 for (int i = 0; i < num_tabs; ++i) |
196 AddBlankTabAndShow(browser); | 193 AddBlankTabAndShow(browser); |
197 ASSERT_EQ(num_tabs + 1, browser->tab_strip_model()->count()); | 194 ASSERT_EQ(num_tabs + 1, browser->tab_strip_model()->count()); |
198 ASSERT_EQ(num_tabs, browser->tab_strip_model()->active_index()); | 195 ASSERT_EQ(num_tabs, browser->tab_strip_model()->active_index()); |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 | 494 |
498 SendScrubEvent(browser(), 1); | 495 SendScrubEvent(browser(), 1); |
499 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); | 496 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); |
500 browser()->tab_strip_model()->ToggleSelectionAt(0); | 497 browser()->tab_strip_model()->ToggleSelectionAt(0); |
501 browser()->tab_strip_model()->ToggleSelectionAt(2); | 498 browser()->tab_strip_model()->ToggleSelectionAt(2); |
502 browser()->tab_strip_model()->MoveSelectedTabsTo(2); | 499 browser()->tab_strip_model()->MoveSelectedTabsTo(2); |
503 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); | 500 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); |
504 } | 501 } |
505 | 502 |
506 #endif // defined(OS_CHROMEOS) | 503 #endif // defined(OS_CHROMEOS) |
OLD | NEW |