| 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 "ash/display/event_transformation_handler.h" | 7 #include "ash/display/event_transformation_handler.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 aura::Window* root = window->GetRootWindow(); | 101 aura::Window* root = window->GetRootWindow(); |
| 102 ui::test::EventGenerator event_generator(root, window); | 102 ui::test::EventGenerator event_generator(root, window); |
| 103 int active_index = browser->tab_strip_model()->active_index(); | 103 int active_index = browser->tab_strip_model()->active_index(); |
| 104 TabScrubber::Direction direction = index < active_index ? | 104 TabScrubber::Direction direction = index < active_index ? |
| 105 TabScrubber::LEFT : TabScrubber::RIGHT; | 105 TabScrubber::LEFT : TabScrubber::RIGHT; |
| 106 | 106 |
| 107 direction = InvertDirectionIfNeeded(direction); | 107 direction = InvertDirectionIfNeeded(direction); |
| 108 | 108 |
| 109 float offset = GetTabCenter(browser, index) - | 109 float offset = GetTabCenter(browser, index) - |
| 110 GetStartX(browser, active_index, direction); | 110 GetStartX(browser, active_index, direction); |
| 111 ui::ScrollEvent scroll_event(ui::ET_SCROLL, | 111 ui::ScrollEvent scroll_event(ui::ET_SCROLL, gfx::Point(0, 0), |
| 112 gfx::PointF(0, 0), | 112 ui::EventTimeForNow(), 0, offset, 0, offset, 0, |
| 113 ui::EventTimeForNow(), | |
| 114 0, | |
| 115 offset, 0, | |
| 116 offset, 0, | |
| 117 3); | 113 3); |
| 118 event_generator.Dispatch(&scroll_event); | 114 event_generator.Dispatch(&scroll_event); |
| 119 } | 115 } |
| 120 | 116 |
| 121 enum ScrubType { | 117 enum ScrubType { |
| 122 EACH_TAB, | 118 EACH_TAB, |
| 123 SKIP_TABS, | 119 SKIP_TABS, |
| 124 REPEAT_TABS, | 120 REPEAT_TABS, |
| 125 }; | 121 }; |
| 126 | 122 |
| (...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 | 494 |
| 499 SendScrubEvent(browser(), 1); | 495 SendScrubEvent(browser(), 1); |
| 500 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); | 496 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); |
| 501 browser()->tab_strip_model()->ToggleSelectionAt(0); | 497 browser()->tab_strip_model()->ToggleSelectionAt(0); |
| 502 browser()->tab_strip_model()->ToggleSelectionAt(2); | 498 browser()->tab_strip_model()->ToggleSelectionAt(2); |
| 503 browser()->tab_strip_model()->MoveSelectedTabsTo(2); | 499 browser()->tab_strip_model()->MoveSelectedTabsTo(2); |
| 504 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); | 500 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); |
| 505 } | 501 } |
| 506 | 502 |
| 507 #endif // defined(OS_CHROMEOS) | 503 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |