| 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" |
| 11 #include "base/callback_helpers.h" | 11 #include "base/callback_helpers.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/macros.h" | 13 #include "base/macros.h" |
| 14 #include "base/run_loop.h" | 14 #include "base/run_loop.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/ui/browser_commands.h" | 16 #include "chrome/browser/ui/browser_commands.h" |
| 17 #include "chrome/browser/ui/browser_tabstrip.h" | 17 #include "chrome/browser/ui/browser_tabstrip.h" |
| 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 18 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" |
| 20 #include "chrome/browser/ui/views/frame/browser_view.h" | 20 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 21 #include "chrome/browser/ui/views/tabs/tab.h" | 21 #include "chrome/browser/ui/views/tabs/tab.h" |
| 22 #include "chrome/browser/ui/views/tabs/tab_strip.h" | 22 #include "chrome/browser/ui/views/tabs/tab_strip.h" |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/test/base/in_process_browser_test.h" | 24 #include "chrome/test/base/in_process_browser_test.h" |
| 25 #include "chrome/test/base/interactive_test_utils.h" |
| 25 #include "content/public/browser/notification_service.h" | 26 #include "content/public/browser/notification_service.h" |
| 26 #include "content/public/common/url_constants.h" | 27 #include "content/public/common/url_constants.h" |
| 27 #include "content/public/test/test_utils.h" | 28 #include "content/public/test/test_utils.h" |
| 28 #include "ui/aura/window.h" | 29 #include "ui/aura/window.h" |
| 29 #include "ui/events/event_utils.h" | 30 #include "ui/events/event_utils.h" |
| 30 #include "ui/events/test/event_generator.h" | 31 #include "ui/events/test/event_generator.h" |
| 31 | 32 |
| 32 #if defined(OS_CHROMEOS) | 33 #if defined(OS_CHROMEOS) |
| 33 #include "chromeos/chromeos_switches.h" | 34 #include "chromeos/chromeos_switches.h" |
| 34 #endif | 35 #endif |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 browser2->window()->Activate(); | 323 browser2->window()->Activate(); |
| 323 ASSERT_TRUE(browser2->window()->IsActive()); | 324 ASSERT_TRUE(browser2->window()->IsActive()); |
| 324 ASSERT_FALSE(browser()->window()->IsActive()); | 325 ASSERT_FALSE(browser()->window()->IsActive()); |
| 325 AddTabs(browser2, 1); | 326 AddTabs(browser2, 1); |
| 326 | 327 |
| 327 Scrub(browser2, 0, EACH_TAB); | 328 Scrub(browser2, 0, EACH_TAB); |
| 328 EXPECT_EQ(0, browser2->tab_strip_model()->active_index()); | 329 EXPECT_EQ(0, browser2->tab_strip_model()->active_index()); |
| 329 } | 330 } |
| 330 | 331 |
| 331 // Tests that tab scrubbing works correctly for a full-screen browser. | 332 // Tests that tab scrubbing works correctly for a full-screen browser. |
| 332 // TODO(crbug.com/708612): Re-enable the test after the bug is fixed. | 333 IN_PROC_BROWSER_TEST_F(TabScrubberTest, FullScreenBrowser) { |
| 333 IN_PROC_BROWSER_TEST_F(TabScrubberTest, DISABLED_FullScreenBrowser) { | 334 // Initializes the position of mouse. Makes the mouse away from the tabstrip |
| 335 // to prevent any interference on this test. |
| 336 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( |
| 337 gfx::Point(0, browser()->window()->GetBounds().height()))); |
| 334 AddTabs(browser(), 6); | 338 AddTabs(browser(), 6); |
| 335 browser()->tab_strip_model()->ActivateTabAt(4, false); | 339 browser()->tab_strip_model()->ActivateTabAt(4, false); |
| 336 | 340 |
| 337 chrome::ToggleFullscreenMode(browser()); | 341 chrome::ToggleFullscreenMode(browser()); |
| 338 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( | 342 BrowserView* browser_view = BrowserView::GetBrowserViewForNativeWindow( |
| 339 browser()->window()->GetNativeWindow()); | 343 browser()->window()->GetNativeWindow()); |
| 340 ImmersiveModeController* immersive_controller = | 344 ImmersiveModeController* immersive_controller = |
| 341 browser_view->immersive_mode_controller(); | 345 browser_view->immersive_mode_controller(); |
| 342 EXPECT_TRUE(immersive_controller->IsEnabled()); | 346 EXPECT_TRUE(immersive_controller->IsEnabled()); |
| 343 | 347 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 543 | 547 |
| 544 SendScrubEvent(browser(), 1); | 548 SendScrubEvent(browser(), 1); |
| 545 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); | 549 EXPECT_TRUE(TabScrubber::GetInstance()->IsActivationPending()); |
| 546 browser()->tab_strip_model()->ToggleSelectionAt(0); | 550 browser()->tab_strip_model()->ToggleSelectionAt(0); |
| 547 browser()->tab_strip_model()->ToggleSelectionAt(2); | 551 browser()->tab_strip_model()->ToggleSelectionAt(2); |
| 548 browser()->tab_strip_model()->MoveSelectedTabsTo(2); | 552 browser()->tab_strip_model()->MoveSelectedTabsTo(2); |
| 549 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); | 553 EXPECT_EQ(0, TabScrubber::GetInstance()->highlighted_tab()); |
| 550 } | 554 } |
| 551 | 555 |
| 552 #endif // defined(OS_CHROMEOS) | 556 #endif // defined(OS_CHROMEOS) |
| OLD | NEW |