OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/shell_window.h" | 5 #include "apps/shell_window.h" |
6 #include "apps/shell_window_registry.h" | 6 #include "apps/shell_window_registry.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "chrome/browser/apps/app_browsertest_util.h" | 9 #include "chrome/browser/apps/app_browsertest_util.h" |
10 #include "chrome/browser/extensions/extension_test_message_listener.h" | 10 #include "chrome/browser/extensions/extension_test_message_listener.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 using apps::ShellWindow; | 26 using apps::ShellWindow; |
27 | 27 |
28 class WebViewInteractiveTest | 28 class WebViewInteractiveTest |
29 : public extensions::PlatformAppBrowserTest { | 29 : public extensions::PlatformAppBrowserTest { |
30 public: | 30 public: |
31 WebViewInteractiveTest() | 31 WebViewInteractiveTest() |
32 : corner_(gfx::Point()), | 32 : corner_(gfx::Point()), |
33 mouse_click_result_(false), | 33 mouse_click_result_(false), |
34 first_click_(true) {} | 34 first_click_(true) {} |
35 | 35 |
| 36 virtual void SetUp() OVERRIDE { |
| 37 // We need real contexts, otherwise the embedder doesn't composite, but the |
| 38 // guest does, and that isn't an expected configuration. |
| 39 UseRealGLContexts(); |
| 40 extensions::PlatformAppBrowserTest::SetUp(); |
| 41 } |
| 42 |
36 void MoveMouseInsideWindowWithListener(gfx::Point point, | 43 void MoveMouseInsideWindowWithListener(gfx::Point point, |
37 const std::string& message) { | 44 const std::string& message) { |
38 ExtensionTestMessageListener move_listener(message, false); | 45 ExtensionTestMessageListener move_listener(message, false); |
39 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( | 46 ASSERT_TRUE(ui_test_utils::SendMouseMoveSync( |
40 gfx::Point(corner_.x() + point.x(), corner_.y() + point.y()))); | 47 gfx::Point(corner_.x() + point.x(), corner_.y() + point.y()))); |
41 ASSERT_TRUE(move_listener.WaitUntilSatisfied()); | 48 ASSERT_TRUE(move_listener.WaitUntilSatisfied()); |
42 } | 49 } |
43 | 50 |
44 void SendMouseClickWithListener(ui_controls::MouseButton button, | 51 void SendMouseClickWithListener(ui_controls::MouseButton button, |
45 const std::string& message) { | 52 const std::string& message) { |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 195 |
189 guest_web_contents_ = source->GetWebContents(); | 196 guest_web_contents_ = source->GetWebContents(); |
190 embedder_web_contents_ = guest_web_contents_->GetEmbedderWebContents(); | 197 embedder_web_contents_ = guest_web_contents_->GetEmbedderWebContents(); |
191 | 198 |
192 gfx::Rect offset; | 199 gfx::Rect offset; |
193 embedder_web_contents_->GetView()->GetContainerBounds(&offset); | 200 embedder_web_contents_->GetView()->GetContainerBounds(&offset); |
194 corner_ = gfx::Point(offset.x(), offset.y()); | 201 corner_ = gfx::Point(offset.x(), offset.y()); |
195 | 202 |
196 const testing::TestInfo* const test_info = | 203 const testing::TestInfo* const test_info = |
197 testing::UnitTest::GetInstance()->current_test_info(); | 204 testing::UnitTest::GetInstance()->current_test_info(); |
198 const std::string& prefix = "DragDropWithinWebView"; | 205 const std::string& prefix = "FLAKY_DragDropWithinWebView"; |
199 if (!strncmp(test_info->name(), prefix.c_str(), prefix.size())) { | 206 if (!strncmp(test_info->name(), prefix.c_str(), prefix.size())) { |
200 // In the drag drop test we add 20px padding to the page body because on | 207 // In the drag drop test we add 20px padding to the page body because on |
201 // windows if we get too close to the edge of the window the resize cursor | 208 // windows if we get too close to the edge of the window the resize cursor |
202 // appears and we start dragging the window edge. | 209 // appears and we start dragging the window edge. |
203 corner_.Offset(20, 20); | 210 corner_.Offset(20, 20); |
204 } | 211 } |
205 } | 212 } |
206 | 213 |
207 content::WebContents* guest_web_contents() { | 214 content::WebContents* guest_web_contents() { |
208 return guest_web_contents_; | 215 return guest_web_contents_; |
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 "/guest.html"); | 614 "/guest.html"); |
608 ASSERT_TRUE(guest_web_contents()); | 615 ASSERT_TRUE(guest_web_contents()); |
609 | 616 |
610 PopupTestHelper(gfx::Point(20, 0)); | 617 PopupTestHelper(gfx::Point(20, 0)); |
611 } | 618 } |
612 | 619 |
613 // Drag and drop inside a webview is currently only enabled for linux and mac, | 620 // Drag and drop inside a webview is currently only enabled for linux and mac, |
614 // but the tests don't work on anything except chromeos for now. This is because | 621 // but the tests don't work on anything except chromeos for now. This is because |
615 // of simulating mouse drag code's dependency on platforms. | 622 // of simulating mouse drag code's dependency on platforms. |
616 #if defined(OS_CHROMEOS) | 623 #if defined(OS_CHROMEOS) |
617 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, DragDropWithinWebView) { | 624 // http://crbug.com/281001 |
| 625 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, FLAKY_DragDropWithinWebView) { |
618 SetupTest( | 626 SetupTest( |
619 "web_view/dnd_within_webview", | 627 "web_view/dnd_within_webview", |
620 "/extensions/platform_apps/web_view/dnd_within_webview/guest.html"); | 628 "/extensions/platform_apps/web_view/dnd_within_webview/guest.html"); |
621 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(GetPlatformAppWindow())); | 629 ASSERT_TRUE(ui_test_utils::ShowAndFocusNativeWindow(GetPlatformAppWindow())); |
622 | 630 |
623 // Flush any pending events to make sure we start with a clean slate. | 631 // Flush any pending events to make sure we start with a clean slate. |
624 content::RunAllPendingInMessageLoop(); | 632 content::RunAllPendingInMessageLoop(); |
625 base::RunLoop run_loop; | 633 base::RunLoop run_loop; |
626 quit_closure_ = run_loop.QuitClosure(); | 634 quit_closure_ = run_loop.QuitClosure(); |
627 base::MessageLoop::current()->PostTask( | 635 base::MessageLoop::current()->PostDelayedTask( |
628 FROM_HERE, | 636 FROM_HERE, |
629 base::Bind(&WebViewInteractiveTest::DragTestStep1, | 637 base::Bind(&WebViewInteractiveTest::DragTestStep1, |
630 base::Unretained(this))); | 638 base::Unretained(this)), |
| 639 base::TimeDelta::FromMilliseconds(1000)); |
631 run_loop.Run(); | 640 run_loop.Run(); |
632 } | 641 } |
633 #endif // (defined(OS_CHROMEOS)) | 642 #endif // (defined(OS_CHROMEOS)) |
634 | 643 |
635 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Navigation) { | 644 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Navigation) { |
636 TestHelper("testNavigation", | 645 TestHelper("testNavigation", |
637 "DoneNavigationTest.PASSED", | 646 "DoneNavigationTest.PASSED", |
638 "DoneNavigationTest.FAILED", | 647 "DoneNavigationTest.FAILED", |
639 "web_view/navigation"); | 648 "web_view/navigation"); |
640 } | 649 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
675 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 684 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
676 } | 685 } |
677 | 686 |
678 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, | 687 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, |
679 PointerLock_PointerLockLostWithFocus) { | 688 PointerLock_PointerLockLostWithFocus) { |
680 TestHelper("testPointerLockLostWithFocus", | 689 TestHelper("testPointerLockLostWithFocus", |
681 "DonePointerLockTest.PASSED", | 690 "DonePointerLockTest.PASSED", |
682 "DonePointerLockTest.FAILED", | 691 "DonePointerLockTest.FAILED", |
683 "web_view/pointerlock"); | 692 "web_view/pointerlock"); |
684 } | 693 } |
OLD | NEW |