| 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 "base/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
| 6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
| 7 #include "chrome/app/chrome_command_ids.h" | 7 #include "chrome/app/chrome_command_ids.h" |
| 8 #include "chrome/browser/apps/app_browsertest_util.h" | 8 #include "chrome/browser/apps/app_browsertest_util.h" |
| 9 #include "chrome/browser/chrome_content_browser_client.h" | 9 #include "chrome/browser/chrome_content_browser_client.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 | 521 |
| 522 std::string last_drop_data; | 522 std::string last_drop_data; |
| 523 EXPECT_TRUE(content::ExecuteScriptAndExtractString( | 523 EXPECT_TRUE(content::ExecuteScriptAndExtractString( |
| 524 embedder_web_contents_, | 524 embedder_web_contents_, |
| 525 "window.domAutomationController.send(getLastDropData())", | 525 "window.domAutomationController.send(getLastDropData())", |
| 526 &last_drop_data)); | 526 &last_drop_data)); |
| 527 | 527 |
| 528 last_drop_data_ = last_drop_data; | 528 last_drop_data_ = last_drop_data; |
| 529 } | 529 } |
| 530 | 530 |
| 531 void FullscreenTestHelper(const std::string& test_name, |
| 532 const std::string& test_dir) { |
| 533 TestHelper(test_name, test_dir, NO_TEST_SERVER); |
| 534 content::WebContents* embedder_web_contents = |
| 535 GetFirstAppWindowWebContents(); |
| 536 ASSERT_TRUE(embedder_web_contents); |
| 537 ASSERT_TRUE(guest_web_contents()); |
| 538 // Click the guest to request fullscreen. |
| 539 ExtensionTestMessageListener passed_listener( |
| 540 "FULLSCREEN_STEP_PASSED", false); |
| 541 passed_listener.set_failure_message("TEST_FAILED"); |
| 542 content::SimulateMouseClickAt(guest_web_contents(), |
| 543 0, |
| 544 blink::WebMouseEvent::ButtonLeft, |
| 545 gfx::Point(20, 20)); |
| 546 ASSERT_TRUE(passed_listener.WaitUntilSatisfied()); |
| 547 } |
| 548 |
| 531 protected: | 549 protected: |
| 532 TestGuestViewManagerFactory factory_; | 550 TestGuestViewManagerFactory factory_; |
| 533 content::WebContents* guest_web_contents_; | 551 content::WebContents* guest_web_contents_; |
| 534 content::WebContents* embedder_web_contents_; | 552 content::WebContents* embedder_web_contents_; |
| 535 gfx::Point corner_; | 553 gfx::Point corner_; |
| 536 bool mouse_click_result_; | 554 bool mouse_click_result_; |
| 537 bool first_click_; | 555 bool first_click_; |
| 538 // Only used in drag/drop test. | 556 // Only used in drag/drop test. |
| 539 base::Closure quit_closure_; | 557 base::Closure quit_closure_; |
| 540 std::string last_drop_data_; | 558 std::string last_drop_data_; |
| (...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 991 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); | 1009 ASSERT_TRUE(done_listener.WaitUntilSatisfied()); |
| 992 } | 1010 } |
| 993 | 1011 |
| 994 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, | 1012 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, |
| 995 PointerLock_PointerLockLostWithFocus) { | 1013 PointerLock_PointerLockLostWithFocus) { |
| 996 TestHelper("testPointerLockLostWithFocus", | 1014 TestHelper("testPointerLockLostWithFocus", |
| 997 "web_view/pointerlock", | 1015 "web_view/pointerlock", |
| 998 NO_TEST_SERVER); | 1016 NO_TEST_SERVER); |
| 999 } | 1017 } |
| 1000 | 1018 |
| 1019 // Disable this on mac, throws an assertion failure on teardown which |
| 1020 // will result in flakiness: |
| 1021 // |
| 1022 // "not is fullscreen state" |
| 1023 // "*** Assertion failure in -[_NSWindowFullScreenTransition |
| 1024 // transitionedWindowFrame]," |
| 1025 // See similar bug: http://crbug.com/169820. |
| 1026 #if defined(OS_MACOSX) |
| 1027 #define MAYBE_FullscreenAllow_EmbedderHasPermission \ |
| 1028 DISABLED_FullscreenAllow_EmbedderHasPermission |
| 1029 #else |
| 1030 #define MAYBE_FullscreenAllow_EmbedderHasPermission \ |
| 1031 FullscreenAllow_EmbedderHasPermission |
| 1032 #endif |
| 1033 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, |
| 1034 MAYBE_FullscreenAllow_EmbedderHasPermission) { |
| 1035 FullscreenTestHelper("testFullscreenAllow", |
| 1036 "web_view/fullscreen/embedder_has_permission"); |
| 1037 } |
| 1038 |
| 1039 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, |
| 1040 FullscreenDeny_EmbedderHasPermission) { |
| 1041 FullscreenTestHelper("testFullscreenDeny", |
| 1042 "web_view/fullscreen/embedder_has_permission"); |
| 1043 } |
| 1044 |
| 1045 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, |
| 1046 FullscreenAllow_EmbedderHasNoPermission) { |
| 1047 FullscreenTestHelper("testFullscreenAllow", |
| 1048 "web_view/fullscreen/embedder_has_no_permission"); |
| 1049 } |
| 1050 |
| 1051 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, |
| 1052 FullscreenDeny_EmbedderHasNoPermission) { |
| 1053 FullscreenTestHelper("testFullscreenDeny", |
| 1054 "web_view/fullscreen/embedder_has_no_permission"); |
| 1055 } |
| 1056 |
| 1001 // This test exercies the following scenario: | 1057 // This test exercies the following scenario: |
| 1002 // 1. An <input> in guest has focus. | 1058 // 1. An <input> in guest has focus. |
| 1003 // 2. User takes focus to embedder by clicking e.g. an <input> in embedder. | 1059 // 2. User takes focus to embedder by clicking e.g. an <input> in embedder. |
| 1004 // 3. User brings back the focus directly to the <input> in #1. | 1060 // 3. User brings back the focus directly to the <input> in #1. |
| 1005 // | 1061 // |
| 1006 // Now we need to make sure TextInputTypeChanged fires properly for the guest's | 1062 // Now we need to make sure TextInputTypeChanged fires properly for the guest's |
| 1007 // view upon step #3. We simply read the input type's state after #3 to | 1063 // view upon step #3. We simply read the input type's state after #3 to |
| 1008 // make sure it's not TEXT_INPUT_TYPE_NONE. | 1064 // make sure it's not TEXT_INPUT_TYPE_NONE. |
| 1009 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Focus_FocusRestored) { | 1065 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Focus_FocusRestored) { |
| 1010 TestHelper("testFocusRestored", "web_view/focus", NO_TEST_SERVER); | 1066 TestHelper("testFocusRestored", "web_view/focus", NO_TEST_SERVER); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 | 1215 |
| 1160 // Now verify that the selection text propagates properly to RWHV. | 1216 // Now verify that the selection text propagates properly to RWHV. |
| 1161 content::RenderWidgetHostView* guest_rwhv = | 1217 content::RenderWidgetHostView* guest_rwhv = |
| 1162 guest_web_contents()->GetRenderWidgetHostView(); | 1218 guest_web_contents()->GetRenderWidgetHostView(); |
| 1163 ASSERT_TRUE(guest_rwhv); | 1219 ASSERT_TRUE(guest_rwhv); |
| 1164 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); | 1220 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); |
| 1165 ASSERT_TRUE(selected_text.size() >= 10u); | 1221 ASSERT_TRUE(selected_text.size() >= 10u); |
| 1166 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); | 1222 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); |
| 1167 } | 1223 } |
| 1168 #endif | 1224 #endif |
| OLD | NEW |