| 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/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 576 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 aura::test::EventGenerator generator(content->GetRootWindow(), content); | 587 aura::test::EventGenerator generator(content->GetRootWindow(), content); |
| 588 generator.GestureScrollSequence( | 588 generator.GestureScrollSequence( |
| 589 gfx::Point(bounds.x() + 2, bounds.y() + 10), | 589 gfx::Point(bounds.x() + 2, bounds.y() + 10), |
| 590 gfx::Point(bounds.right() - 10, bounds.y() + 10), | 590 gfx::Point(bounds.right() - 10, bounds.y() + 10), |
| 591 base::TimeDelta::FromMilliseconds(20), | 591 base::TimeDelta::FromMilliseconds(20), |
| 592 1); | 592 1); |
| 593 | 593 |
| 594 window->AddChild(shell()->web_contents()->GetContentNativeView()); | 594 window->AddChild(shell()->web_contents()->GetContentNativeView()); |
| 595 } | 595 } |
| 596 | 596 |
| 597 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, | 597 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, ContentWindowClose) { |
| 598 ContentWindowClose) { | |
| 599 ASSERT_NO_FATAL_FAILURE( | 598 ASSERT_NO_FATAL_FAILURE( |
| 600 StartTestWithPage("files/overscroll_navigation.html")); | 599 StartTestWithPage("files/overscroll_navigation.html")); |
| 601 | 600 |
| 602 WebContentsImpl* web_contents = | 601 WebContentsImpl* web_contents = |
| 603 static_cast<WebContentsImpl*>(shell()->web_contents()); | 602 static_cast<WebContentsImpl*>(shell()->web_contents()); |
| 604 ExecuteSyncJSFunction(web_contents->GetMainFrame(), "navigate_next()"); | 603 ExecuteSyncJSFunction(web_contents->GetMainFrame(), "navigate_next()"); |
| 605 EXPECT_EQ(1, GetCurrentIndex()); | 604 EXPECT_EQ(1, GetCurrentIndex()); |
| 606 | 605 |
| 607 aura::Window* content = web_contents->GetContentNativeView(); | 606 aura::Window* content = web_contents->GetContentNativeView(); |
| 608 gfx::Rect bounds = content->GetBoundsInRootWindow(); | 607 gfx::Rect bounds = content->GetBoundsInRootWindow(); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 base::TimeDelta::FromMilliseconds(2000), | 676 base::TimeDelta::FromMilliseconds(2000), |
| 678 10); | 677 10); |
| 679 base::string16 actual_title = title_watcher.WaitAndGetTitle(); | 678 base::string16 actual_title = title_watcher.WaitAndGetTitle(); |
| 680 EXPECT_EQ(expected_title, actual_title); | 679 EXPECT_EQ(expected_title, actual_title); |
| 681 | 680 |
| 682 EXPECT_EQ(2, GetCurrentIndex()); | 681 EXPECT_EQ(2, GetCurrentIndex()); |
| 683 EXPECT_TRUE(controller.CanGoBack()); | 682 EXPECT_TRUE(controller.CanGoBack()); |
| 684 EXPECT_FALSE(controller.CanGoForward()); | 683 EXPECT_FALSE(controller.CanGoForward()); |
| 685 } | 684 } |
| 686 | 685 |
| 686 // Verify that hiding a parent of the renderer will hide the content too. |
| 687 IN_PROC_BROWSER_TEST_F(WebContentsViewAuraTest, HideContentOnParenHide) { |
| 688 ASSERT_NO_FATAL_FAILURE(StartTestWithPage("files/title1.html")); |
| 689 WebContentsImpl* web_contents = |
| 690 static_cast<WebContentsImpl*>(shell()->web_contents()); |
| 691 aura::Window* content = web_contents->GetNativeView()->parent(); |
| 692 aura::Window* parent = content->parent(); |
| 693 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
| 694 parent->Hide(); |
| 695 EXPECT_FALSE(web_contents->should_normally_be_visible()); |
| 696 parent->Show(); |
| 697 EXPECT_TRUE(web_contents->should_normally_be_visible()); |
| 698 } |
| 699 |
| 687 } // namespace content | 700 } // namespace content |
| OLD | NEW |