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 "content/browser/web_contents/web_contents_view_aura.h" | 5 #include "content/browser/web_contents/web_contents_view_aura.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 #include "content/public/browser/render_widget_host.h" | 29 #include "content/public/browser/render_widget_host.h" |
30 #include "content/public/browser/web_contents_delegate.h" | 30 #include "content/public/browser/web_contents_delegate.h" |
31 #include "content/public/browser/web_contents_observer.h" | 31 #include "content/public/browser/web_contents_observer.h" |
32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
33 #include "content/public/test/browser_test_utils.h" | 33 #include "content/public/test/browser_test_utils.h" |
34 #include "content/public/test/content_browser_test.h" | 34 #include "content/public/test/content_browser_test.h" |
35 #include "content/public/test/content_browser_test_utils.h" | 35 #include "content/public/test/content_browser_test_utils.h" |
36 #include "content/public/test/test_renderer_host.h" | 36 #include "content/public/test/test_renderer_host.h" |
37 #include "content/public/test/test_utils.h" | 37 #include "content/public/test/test_utils.h" |
38 #include "content/shell/browser/shell.h" | 38 #include "content/shell/browser/shell.h" |
| 39 #include "net/test/embedded_test_server/embedded_test_server.h" |
39 #include "ui/aura/window.h" | 40 #include "ui/aura/window.h" |
40 #include "ui/aura/window_tree_host.h" | 41 #include "ui/aura/window_tree_host.h" |
41 #include "ui/compositor/scoped_animation_duration_scale_mode.h" | 42 #include "ui/compositor/scoped_animation_duration_scale_mode.h" |
42 #include "ui/events/event_processor.h" | 43 #include "ui/events/event_processor.h" |
43 #include "ui/events/event_switches.h" | 44 #include "ui/events/event_switches.h" |
44 #include "ui/events/event_utils.h" | 45 #include "ui/events/event_utils.h" |
45 #include "ui/events/test/event_generator.h" | 46 #include "ui/events/test/event_generator.h" |
46 | 47 |
47 namespace { | 48 namespace { |
48 | 49 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 // freed properly. | 244 // freed properly. |
244 void ExecuteSyncJSFunction(RenderFrameHost* rfh, const std::string& jscript) { | 245 void ExecuteSyncJSFunction(RenderFrameHost* rfh, const std::string& jscript) { |
245 scoped_ptr<base::Value> value = | 246 scoped_ptr<base::Value> value = |
246 content::ExecuteScriptAndGetValue(rfh, jscript); | 247 content::ExecuteScriptAndGetValue(rfh, jscript); |
247 } | 248 } |
248 | 249 |
249 // Starts the test server and navigates to the given url. Sets a large enough | 250 // Starts the test server and navigates to the given url. Sets a large enough |
250 // size to the root window. Returns after the navigation to the url is | 251 // size to the root window. Returns after the navigation to the url is |
251 // complete. | 252 // complete. |
252 void StartTestWithPage(const std::string& url) { | 253 void StartTestWithPage(const std::string& url) { |
253 ASSERT_TRUE(test_server()->Start()); | 254 ASSERT_TRUE(embedded_test_server()->Start()); |
254 GURL test_url(test_server()->GetURL(url)); | 255 GURL test_url; |
| 256 if (url == "about:blank") |
| 257 test_url = GURL(url); |
| 258 else |
| 259 test_url = GURL(embedded_test_server()->GetURL(url)); |
255 NavigateToURL(shell(), test_url); | 260 NavigateToURL(shell(), test_url); |
256 | 261 |
257 WebContentsImpl* web_contents = | 262 WebContentsImpl* web_contents = |
258 static_cast<WebContentsImpl*>(shell()->web_contents()); | 263 static_cast<WebContentsImpl*>(shell()->web_contents()); |
259 NavigationControllerImpl* controller = &web_contents->GetController(); | 264 NavigationControllerImpl* controller = &web_contents->GetController(); |
260 | 265 |
261 screenshot_manager_ = new ScreenshotTracker(controller); | 266 screenshot_manager_ = new ScreenshotTracker(controller); |
262 controller->SetScreenshotManager(make_scoped_ptr(screenshot_manager_)); | 267 controller->SetScreenshotManager(make_scoped_ptr(screenshot_manager_)); |
263 | 268 |
264 frame_watcher_ = new FrameWatcher(); | 269 frame_watcher_ = new FrameWatcher(); |
265 GetRenderWidgetHost()->GetProcess()->AddFilter(frame_watcher_.get()); | 270 GetRenderWidgetHost()->GetProcess()->AddFilter(frame_watcher_.get()); |
266 } | 271 } |
267 | 272 |
268 void SetUpCommandLine(base::CommandLine* cmd) override { | 273 void SetUpCommandLine(base::CommandLine* cmd) override { |
269 cmd->AppendSwitchASCII(switches::kTouchEvents, | 274 cmd->AppendSwitchASCII(switches::kTouchEvents, |
270 switches::kTouchEventsEnabled); | 275 switches::kTouchEventsEnabled); |
271 } | 276 } |
272 | 277 |
273 void TestOverscrollNavigation(bool touch_handler) { | 278 void TestOverscrollNavigation(bool touch_handler) { |
274 ASSERT_NO_FATAL_FAILURE( | 279 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
275 StartTestWithPage("files/overscroll_navigation.html")); | |
276 WebContentsImpl* web_contents = | 280 WebContentsImpl* web_contents = |
277 static_cast<WebContentsImpl*>(shell()->web_contents()); | 281 static_cast<WebContentsImpl*>(shell()->web_contents()); |
278 NavigationController& controller = web_contents->GetController(); | 282 NavigationController& controller = web_contents->GetController(); |
279 RenderFrameHost* main_frame = web_contents->GetMainFrame(); | 283 RenderFrameHost* main_frame = web_contents->GetMainFrame(); |
280 | 284 |
281 EXPECT_FALSE(controller.CanGoBack()); | 285 EXPECT_FALSE(controller.CanGoBack()); |
282 EXPECT_FALSE(controller.CanGoForward()); | 286 EXPECT_FALSE(controller.CanGoForward()); |
283 int index = -1; | 287 int index = -1; |
284 scoped_ptr<base::Value> value = | 288 scoped_ptr<base::Value> value = |
285 content::ExecuteScriptAndGetValue(main_frame, "get_current()"); | 289 content::ExecuteScriptAndGetValue(main_frame, "get_current()"); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
460 // bots, and usually but not always passes second-try (See crbug.com/179532). | 464 // bots, and usually but not always passes second-try (See crbug.com/179532). |
461 // On Linux, the test frequently times out. (See crbug.com/440043). | 465 // On Linux, the test frequently times out. (See crbug.com/440043). |
462 #if defined(OS_WIN) || defined(OS_LINUX) | 466 #if defined(OS_WIN) || defined(OS_LINUX) |
463 #define MAYBE_QuickOverscrollDirectionChange \ | 467 #define MAYBE_QuickOverscrollDirectionChange \ |
464 DISABLED_QuickOverscrollDirectionChange | 468 DISABLED_QuickOverscrollDirectionChange |
465 #else | 469 #else |
466 #define MAYBE_QuickOverscrollDirectionChange QuickOverscrollDirectionChange | 470 #define MAYBE_QuickOverscrollDirectionChange QuickOverscrollDirectionChange |
467 #endif | 471 #endif |
468 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 472 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, |
469 MAYBE_QuickOverscrollDirectionChange) { | 473 MAYBE_QuickOverscrollDirectionChange) { |
470 ASSERT_NO_FATAL_FAILURE( | 474 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
471 StartTestWithPage("files/overscroll_navigation.html")); | |
472 WebContentsImpl* web_contents = | 475 WebContentsImpl* web_contents = |
473 static_cast<WebContentsImpl*>(shell()->web_contents()); | 476 static_cast<WebContentsImpl*>(shell()->web_contents()); |
474 RenderFrameHost* main_frame = web_contents->GetMainFrame(); | 477 RenderFrameHost* main_frame = web_contents->GetMainFrame(); |
475 | 478 |
476 // This test triggers a large number of animations. Speed them up to ensure | 479 // This test triggers a large number of animations. Speed them up to ensure |
477 // the test completes within its time limit. | 480 // the test completes within its time limit. |
478 ui::ScopedAnimationDurationScaleMode fast_duration_mode( | 481 ui::ScopedAnimationDurationScaleMode fast_duration_mode( |
479 ui::ScopedAnimationDurationScaleMode::FAST_DURATION); | 482 ui::ScopedAnimationDurationScaleMode::FAST_DURATION); |
480 | 483 |
481 // Make sure the page has both back/forward history. | 484 // Make sure the page has both back/forward history. |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
556 #endif | 559 #endif |
557 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_OverscrollScreenshot) { | 560 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, MAYBE_OverscrollScreenshot) { |
558 // Disable the test for WinXP. See http://crbug/294116. | 561 // Disable the test for WinXP. See http://crbug/294116. |
559 #if defined(OS_WIN) | 562 #if defined(OS_WIN) |
560 if (base::win::GetVersion() < base::win::VERSION_VISTA) { | 563 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
561 LOG(WARNING) << "Test disabled due to unknown bug on WinXP."; | 564 LOG(WARNING) << "Test disabled due to unknown bug on WinXP."; |
562 return; | 565 return; |
563 } | 566 } |
564 #endif | 567 #endif |
565 | 568 |
566 ASSERT_NO_FATAL_FAILURE( | 569 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
567 StartTestWithPage("files/overscroll_navigation.html")); | |
568 WebContentsImpl* web_contents = | 570 WebContentsImpl* web_contents = |
569 static_cast<WebContentsImpl*>(shell()->web_contents()); | 571 static_cast<WebContentsImpl*>(shell()->web_contents()); |
570 RenderFrameHost* main_frame = web_contents->GetMainFrame(); | 572 RenderFrameHost* main_frame = web_contents->GetMainFrame(); |
571 | 573 |
572 set_min_screenshot_interval(0); | 574 set_min_screenshot_interval(0); |
573 | 575 |
574 // Do a few navigations initiated by the page. | 576 // Do a few navigations initiated by the page. |
575 // Screenshots should never be captured since these are all in-page | 577 // Screenshots should never be captured since these are all in-page |
576 // navigations. | 578 // navigations. |
577 ExecuteSyncJSFunction(main_frame, "navigate_next()"); | 579 ExecuteSyncJSFunction(main_frame, "navigate_next()"); |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
646 #define MAYBE_ScreenshotForSwappedOutRenderViews \ | 648 #define MAYBE_ScreenshotForSwappedOutRenderViews \ |
647 DISABLED_ScreenshotForSwappedOutRenderViews | 649 DISABLED_ScreenshotForSwappedOutRenderViews |
648 #else | 650 #else |
649 #define MAYBE_ScreenshotForSwappedOutRenderViews \ | 651 #define MAYBE_ScreenshotForSwappedOutRenderViews \ |
650 ScreenshotForSwappedOutRenderViews | 652 ScreenshotForSwappedOutRenderViews |
651 #endif | 653 #endif |
652 // Tests that screenshot is taken correctly when navigation causes a | 654 // Tests that screenshot is taken correctly when navigation causes a |
653 // RenderViewHost to be swapped out. | 655 // RenderViewHost to be swapped out. |
654 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 656 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, |
655 MAYBE_ScreenshotForSwappedOutRenderViews) { | 657 MAYBE_ScreenshotForSwappedOutRenderViews) { |
656 ASSERT_NO_FATAL_FAILURE( | 658 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
657 StartTestWithPage("files/overscroll_navigation.html")); | |
658 // Create a new server with a different site. | 659 // Create a new server with a different site. |
659 net::SpawnedTestServer https_server( | 660 net::EmbeddedTestServer https_server(net::EmbeddedTestServer::TYPE_HTTPS); |
660 net::SpawnedTestServer::TYPE_HTTPS, | 661 https_server.ServeFilesFromSourceDirectory("content/test/data"); |
661 net::SpawnedTestServer::kLocalhost, | |
662 base::FilePath(FILE_PATH_LITERAL("content/test/data"))); | |
663 ASSERT_TRUE(https_server.Start()); | 662 ASSERT_TRUE(https_server.Start()); |
664 | 663 |
665 WebContentsImpl* web_contents = | 664 WebContentsImpl* web_contents = |
666 static_cast<WebContentsImpl*>(shell()->web_contents()); | 665 static_cast<WebContentsImpl*>(shell()->web_contents()); |
667 set_min_screenshot_interval(0); | 666 set_min_screenshot_interval(0); |
668 | 667 |
669 struct { | 668 struct { |
670 GURL url; | 669 GURL url; |
671 int transition; | 670 int transition; |
672 } navigations[] = { | 671 } navigations[] = { |
673 { https_server.GetURL("files/title1.html"), | 672 {https_server.GetURL("/title1.html"), |
674 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR }, | 673 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR}, |
675 { test_server()->GetURL("files/title2.html"), | 674 {embedded_test_server()->GetURL("/title2.html"), |
676 ui::PAGE_TRANSITION_AUTO_BOOKMARK }, | 675 ui::PAGE_TRANSITION_AUTO_BOOKMARK}, |
677 { https_server.GetURL("files/title3.html"), | 676 {https_server.GetURL("/title3.html"), |
678 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR }, | 677 ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR}, |
679 { GURL(), 0 } | 678 {GURL(), 0}}; |
680 }; | |
681 | 679 |
682 screenshot_manager()->Reset(); | 680 screenshot_manager()->Reset(); |
683 for (int i = 0; !navigations[i].url.is_empty(); ++i) { | 681 for (int i = 0; !navigations[i].url.is_empty(); ++i) { |
684 // Navigate via the user initiating a navigation from the UI. | 682 // Navigate via the user initiating a navigation from the UI. |
685 NavigationController::LoadURLParams params(navigations[i].url); | 683 NavigationController::LoadURLParams params(navigations[i].url); |
686 params.transition_type = | 684 params.transition_type = |
687 ui::PageTransitionFromInt(navigations[i].transition); | 685 ui::PageTransitionFromInt(navigations[i].transition); |
688 | 686 |
689 RenderViewHost* old_host = web_contents->GetRenderViewHost(); | 687 RenderViewHost* old_host = web_contents->GetRenderViewHost(); |
690 web_contents->GetController().LoadURLWithParams(params); | 688 web_contents->GetController().LoadURLWithParams(params); |
(...skipping 24 matching lines...) Expand all Loading... |
715 web_contents->GetController().LoadURLWithParams(params); | 713 web_contents->GetController().LoadURLWithParams(params); |
716 WaitForLoadStop(web_contents); | 714 WaitForLoadStop(web_contents); |
717 screenshot_manager()->WaitUntilScreenshotIsReady(); | 715 screenshot_manager()->WaitUntilScreenshotIsReady(); |
718 | 716 |
719 EXPECT_EQ(NULL, screenshot_manager()->screenshot_taken_for()); | 717 EXPECT_EQ(NULL, screenshot_manager()->screenshot_taken_for()); |
720 } | 718 } |
721 | 719 |
722 // Tests that navigations resulting from reloads, history.replaceState, | 720 // Tests that navigations resulting from reloads, history.replaceState, |
723 // and history.pushState do not capture screenshots. | 721 // and history.pushState do not capture screenshots. |
724 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ReplaceStateReloadPushState) { | 722 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ReplaceStateReloadPushState) { |
725 ASSERT_NO_FATAL_FAILURE( | 723 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
726 StartTestWithPage("files/overscroll_navigation.html")); | |
727 WebContentsImpl* web_contents = | 724 WebContentsImpl* web_contents = |
728 static_cast<WebContentsImpl*>(shell()->web_contents()); | 725 static_cast<WebContentsImpl*>(shell()->web_contents()); |
729 RenderFrameHost* main_frame = web_contents->GetMainFrame(); | 726 RenderFrameHost* main_frame = web_contents->GetMainFrame(); |
730 | 727 |
731 set_min_screenshot_interval(0); | 728 set_min_screenshot_interval(0); |
732 screenshot_manager()->Reset(); | 729 screenshot_manager()->Reset(); |
733 ExecuteSyncJSFunction(main_frame, "use_replace_state()"); | 730 ExecuteSyncJSFunction(main_frame, "use_replace_state()"); |
734 screenshot_manager()->WaitUntilScreenshotIsReady(); | 731 screenshot_manager()->WaitUntilScreenshotIsReady(); |
735 // history.replaceState shouldn't capture a screenshot | 732 // history.replaceState shouldn't capture a screenshot |
736 EXPECT_FALSE(screenshot_manager()->screenshot_taken_for()); | 733 EXPECT_FALSE(screenshot_manager()->screenshot_taken_for()); |
(...skipping 17 matching lines...) Expand all Loading... |
754 | 751 |
755 // TODO(sadrul): This test is disabled because it reparents in a way the | 752 // TODO(sadrul): This test is disabled because it reparents in a way the |
756 // FocusController does not support. This code would crash in | 753 // FocusController does not support. This code would crash in |
757 // a production build. It only passed prior to this revision | 754 // a production build. It only passed prior to this revision |
758 // because testing used the old FocusManager which did some | 755 // because testing used the old FocusManager which did some |
759 // different (osbolete) processing. TODO(sadrul) to figure out | 756 // different (osbolete) processing. TODO(sadrul) to figure out |
760 // how this test should work that mimics production code a bit | 757 // how this test should work that mimics production code a bit |
761 // better. | 758 // better. |
762 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 759 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, |
763 DISABLED_ContentWindowReparent) { | 760 DISABLED_ContentWindowReparent) { |
764 ASSERT_NO_FATAL_FAILURE( | 761 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
765 StartTestWithPage("files/overscroll_navigation.html")); | |
766 | 762 |
767 scoped_ptr<aura::Window> window(new aura::Window(NULL)); | 763 scoped_ptr<aura::Window> window(new aura::Window(NULL)); |
768 window->Init(ui::LAYER_NOT_DRAWN); | 764 window->Init(ui::LAYER_NOT_DRAWN); |
769 | 765 |
770 WebContentsImpl* web_contents = | 766 WebContentsImpl* web_contents = |
771 static_cast<WebContentsImpl*>(shell()->web_contents()); | 767 static_cast<WebContentsImpl*>(shell()->web_contents()); |
772 ExecuteSyncJSFunction(web_contents->GetMainFrame(), "navigate_next()"); | 768 ExecuteSyncJSFunction(web_contents->GetMainFrame(), "navigate_next()"); |
773 EXPECT_EQ(1, GetCurrentIndex()); | 769 EXPECT_EQ(1, GetCurrentIndex()); |
774 | 770 |
775 aura::Window* content = web_contents->GetContentNativeView(); | 771 aura::Window* content = web_contents->GetContentNativeView(); |
776 gfx::Rect bounds = content->GetBoundsInRootWindow(); | 772 gfx::Rect bounds = content->GetBoundsInRootWindow(); |
777 ui::test::EventGenerator generator(content->GetRootWindow(), content); | 773 ui::test::EventGenerator generator(content->GetRootWindow(), content); |
778 generator.GestureScrollSequence( | 774 generator.GestureScrollSequence( |
779 gfx::Point(bounds.x() + 2, bounds.y() + 10), | 775 gfx::Point(bounds.x() + 2, bounds.y() + 10), |
780 gfx::Point(bounds.right() - 10, bounds.y() + 10), | 776 gfx::Point(bounds.right() - 10, bounds.y() + 10), |
781 base::TimeDelta::FromMilliseconds(20), | 777 base::TimeDelta::FromMilliseconds(20), |
782 1); | 778 1); |
783 | 779 |
784 window->AddChild(shell()->web_contents()->GetContentNativeView()); | 780 window->AddChild(shell()->web_contents()->GetContentNativeView()); |
785 } | 781 } |
786 | 782 |
787 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ContentWindowClose) { | 783 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ContentWindowClose) { |
788 ASSERT_NO_FATAL_FAILURE( | 784 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
789 StartTestWithPage("files/overscroll_navigation.html")); | |
790 | 785 |
791 WebContentsImpl* web_contents = | 786 WebContentsImpl* web_contents = |
792 static_cast<WebContentsImpl*>(shell()->web_contents()); | 787 static_cast<WebContentsImpl*>(shell()->web_contents()); |
793 ExecuteSyncJSFunction(web_contents->GetMainFrame(), "navigate_next()"); | 788 ExecuteSyncJSFunction(web_contents->GetMainFrame(), "navigate_next()"); |
794 EXPECT_EQ(1, GetCurrentIndex()); | 789 EXPECT_EQ(1, GetCurrentIndex()); |
795 | 790 |
796 aura::Window* content = web_contents->GetContentNativeView(); | 791 aura::Window* content = web_contents->GetContentNativeView(); |
797 gfx::Rect bounds = content->GetBoundsInRootWindow(); | 792 gfx::Rect bounds = content->GetBoundsInRootWindow(); |
798 ui::test::EventGenerator generator(content->GetRootWindow(), content); | 793 ui::test::EventGenerator generator(content->GetRootWindow(), content); |
799 generator.GestureScrollSequence( | 794 generator.GestureScrollSequence( |
(...skipping 11 matching lines...) Expand all Loading... |
811 // tests. Enabling for non-Windows platforms. | 806 // tests. Enabling for non-Windows platforms. |
812 // See http://crbug.com/369871. | 807 // See http://crbug.com/369871. |
813 // For linux, see http://crbug.com/381294 | 808 // For linux, see http://crbug.com/381294 |
814 #define MAYBE_RepeatedQuickOverscrollGestures DISABLED_RepeatedQuickOverscrollGe
stures | 809 #define MAYBE_RepeatedQuickOverscrollGestures DISABLED_RepeatedQuickOverscrollGe
stures |
815 #else | 810 #else |
816 #define MAYBE_RepeatedQuickOverscrollGestures RepeatedQuickOverscrollGestures | 811 #define MAYBE_RepeatedQuickOverscrollGestures RepeatedQuickOverscrollGestures |
817 #endif | 812 #endif |
818 | 813 |
819 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 814 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, |
820 MAYBE_RepeatedQuickOverscrollGestures) { | 815 MAYBE_RepeatedQuickOverscrollGestures) { |
821 ASSERT_NO_FATAL_FAILURE( | 816 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
822 StartTestWithPage("files/overscroll_navigation.html")); | |
823 | 817 |
824 WebContentsImpl* web_contents = | 818 WebContentsImpl* web_contents = |
825 static_cast<WebContentsImpl*>(shell()->web_contents()); | 819 static_cast<WebContentsImpl*>(shell()->web_contents()); |
826 NavigationController& controller = web_contents->GetController(); | 820 NavigationController& controller = web_contents->GetController(); |
827 RenderFrameHost* main_frame = web_contents->GetMainFrame(); | 821 RenderFrameHost* main_frame = web_contents->GetMainFrame(); |
828 ExecuteSyncJSFunction(main_frame, "install_touch_handler()"); | 822 ExecuteSyncJSFunction(main_frame, "install_touch_handler()"); |
829 | 823 |
830 // Navigate twice, then navigate back in history once. | 824 // Navigate twice, then navigate back in history once. |
831 ExecuteSyncJSFunction(main_frame, "navigate_next()"); | 825 ExecuteSyncJSFunction(main_frame, "navigate_next()"); |
832 ExecuteSyncJSFunction(main_frame, "navigate_next()"); | 826 ExecuteSyncJSFunction(main_frame, "navigate_next()"); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
866 base::string16 actual_title = title_watcher.WaitAndGetTitle(); | 860 base::string16 actual_title = title_watcher.WaitAndGetTitle(); |
867 EXPECT_EQ(expected_title, actual_title); | 861 EXPECT_EQ(expected_title, actual_title); |
868 | 862 |
869 EXPECT_EQ(2, GetCurrentIndex()); | 863 EXPECT_EQ(2, GetCurrentIndex()); |
870 EXPECT_TRUE(controller.CanGoBack()); | 864 EXPECT_TRUE(controller.CanGoBack()); |
871 EXPECT_FALSE(controller.CanGoForward()); | 865 EXPECT_FALSE(controller.CanGoForward()); |
872 } | 866 } |
873 | 867 |
874 // Verify that hiding a parent of the renderer will hide the content too. | 868 // Verify that hiding a parent of the renderer will hide the content too. |
875 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, HideContentOnParenHide) { | 869 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, HideContentOnParenHide) { |
876 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("files/title1.html")); | 870 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/title1.html")); |
877 WebContentsImpl* web_contents = | 871 WebContentsImpl* web_contents = |
878 static_cast<WebContentsImpl*>(shell()->web_contents()); | 872 static_cast<WebContentsImpl*>(shell()->web_contents()); |
879 aura::Window* content = web_contents->GetNativeView()->parent(); | 873 aura::Window* content = web_contents->GetNativeView()->parent(); |
880 EXPECT_TRUE(web_contents->should_normally_be_visible()); | 874 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
881 content->Hide(); | 875 content->Hide(); |
882 EXPECT_FALSE(web_contents->should_normally_be_visible()); | 876 EXPECT_FALSE(web_contents->should_normally_be_visible()); |
883 content->Show(); | 877 content->Show(); |
884 EXPECT_TRUE(web_contents->should_normally_be_visible()); | 878 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
885 } | 879 } |
886 | 880 |
887 // Ensure that SnapToPhysicalPixelBoundary() is called on WebContentsView parent | 881 // Ensure that SnapToPhysicalPixelBoundary() is called on WebContentsView parent |
888 // change. This is a regression test for http://crbug.com/388908. | 882 // change. This is a regression test for http://crbug.com/388908. |
889 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, WebContentsViewReparent) { | 883 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, WebContentsViewReparent) { |
890 ASSERT_NO_FATAL_FAILURE( | 884 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
891 StartTestWithPage("files/overscroll_navigation.html")); | |
892 | 885 |
893 scoped_ptr<aura::Window> window(new aura::Window(NULL)); | 886 scoped_ptr<aura::Window> window(new aura::Window(NULL)); |
894 window->Init(ui::LAYER_NOT_DRAWN); | 887 window->Init(ui::LAYER_NOT_DRAWN); |
895 | 888 |
896 RenderWidgetHostViewAura* rwhva = | 889 RenderWidgetHostViewAura* rwhva = |
897 static_cast<RenderWidgetHostViewAura*>( | 890 static_cast<RenderWidgetHostViewAura*>( |
898 shell()->web_contents()->GetRenderWidgetHostView()); | 891 shell()->web_contents()->GetRenderWidgetHostView()); |
899 rwhva->ResetHasSnappedToBoundary(); | 892 rwhva->ResetHasSnappedToBoundary(); |
900 EXPECT_FALSE(rwhva->has_snapped_to_boundary()); | 893 EXPECT_FALSE(rwhva->has_snapped_to_boundary()); |
901 window->AddChild(shell()->web_contents()->GetNativeView()); | 894 window->AddChild(shell()->web_contents()->GetNativeView()); |
902 EXPECT_TRUE(rwhva->has_snapped_to_boundary()); | 895 EXPECT_TRUE(rwhva->has_snapped_to_boundary()); |
903 } | 896 } |
904 | 897 |
905 // Flaky on some platforms, likely for the same reason as other flaky overscroll | 898 // Flaky on some platforms, likely for the same reason as other flaky overscroll |
906 // tests. http://crbug.com/305722 | 899 // tests. http://crbug.com/305722 |
907 // TODO(tdresser): Re-enable this once eager GR is back on. See | 900 // TODO(tdresser): Re-enable this once eager GR is back on. See |
908 // crbug.com/410280. | 901 // crbug.com/410280. |
909 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) | 902 #if defined(OS_WIN) || (defined(OS_LINUX) && !defined(OS_CHROMEOS)) |
910 #define MAYBE_OverscrollNavigationTouchThrottling \ | 903 #define MAYBE_OverscrollNavigationTouchThrottling \ |
911 DISABLED_OverscrollNavigationTouchThrottling | 904 DISABLED_OverscrollNavigationTouchThrottling |
912 #else | 905 #else |
913 #define MAYBE_OverscrollNavigationTouchThrottling \ | 906 #define MAYBE_OverscrollNavigationTouchThrottling \ |
914 DISABLED_OverscrollNavigationTouchThrottling | 907 DISABLED_OverscrollNavigationTouchThrottling |
915 #endif | 908 #endif |
916 | 909 |
917 // Tests that touch moves are not throttled when performing a scroll gesture on | 910 // Tests that touch moves are not throttled when performing a scroll gesture on |
918 // a non-scrollable area, except during gesture-nav. | 911 // a non-scrollable area, except during gesture-nav. |
919 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 912 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, |
920 MAYBE_OverscrollNavigationTouchThrottling) { | 913 MAYBE_OverscrollNavigationTouchThrottling) { |
921 ASSERT_NO_FATAL_FAILURE( | 914 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("/overscroll_navigation.html")); |
922 StartTestWithPage("files/overscroll_navigation.html")); | |
923 | 915 |
924 AddInputEventMessageFilter(); | 916 AddInputEventMessageFilter(); |
925 | 917 |
926 WebContentsImpl* web_contents = | 918 WebContentsImpl* web_contents = |
927 static_cast<WebContentsImpl*>(shell()->web_contents()); | 919 static_cast<WebContentsImpl*>(shell()->web_contents()); |
928 aura::Window* content = web_contents->GetContentNativeView(); | 920 aura::Window* content = web_contents->GetContentNativeView(); |
929 gfx::Rect bounds = content->GetBoundsInRootWindow(); | 921 gfx::Rect bounds = content->GetBoundsInRootWindow(); |
930 const int dx = 20; | 922 const int dx = 20; |
931 | 923 |
932 ExecuteSyncJSFunction(web_contents->GetMainFrame(), | 924 ExecuteSyncJSFunction(web_contents->GetMainFrame(), |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 details = dispatcher->OnEventFromSource(&release); | 1121 details = dispatcher->OnEventFromSource(&release); |
1130 ASSERT_FALSE(details.dispatcher_destroyed); | 1122 ASSERT_FALSE(details.dispatcher_destroyed); |
1131 WaitAFrame(); | 1123 WaitAFrame(); |
1132 | 1124 |
1133 EXPECT_LT(0, tracker.num_overscroll_updates()); | 1125 EXPECT_LT(0, tracker.num_overscroll_updates()); |
1134 EXPECT_FALSE(tracker.overscroll_completed()); | 1126 EXPECT_FALSE(tracker.overscroll_completed()); |
1135 } | 1127 } |
1136 } | 1128 } |
1137 | 1129 |
1138 } // namespace content | 1130 } // namespace content |
OLD | NEW |