Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(248)

Side by Side Diff: chrome/browser/apps/guest_view/web_view_interactive_browsertest.cc

Issue 984963004: <webview>: Implement fullscreen permission for html5 element.requestFullscreen() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tmptmptmp
Patch Set: Clean up for review. Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest,
1020 FullscreenAllow_EmbedderHasPermission) {
1021 FullscreenTestHelper("testFullscreenAllow",
1022 "web_view/fullscreen/embedder_has_permission");
1023 }
1024
1025 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest,
1026 FullscreenDeny_EmbedderHasPermission) {
1027 FullscreenTestHelper("testFullscreenDeny",
1028 "web_view/fullscreen/embedder_has_permission");
1029 }
1030
1031 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest,
1032 FullscreenAllow_EmbedderHasNoPermission) {
1033 FullscreenTestHelper("testFullscreenAllow",
1034 "web_view/fullscreen/embedder_has_no_permission");
1035 }
1036
1037 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest,
1038 FullscreenDeny_EmbedderHasNoPermission) {
1039 FullscreenTestHelper("testFullscreenDeny",
1040 "web_view/fullscreen/embedder_has_no_permission");
1041 }
1042
1001 // This test exercies the following scenario: 1043 // This test exercies the following scenario:
1002 // 1. An <input> in guest has focus. 1044 // 1. An <input> in guest has focus.
1003 // 2. User takes focus to embedder by clicking e.g. an <input> in embedder. 1045 // 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. 1046 // 3. User brings back the focus directly to the <input> in #1.
1005 // 1047 //
1006 // Now we need to make sure TextInputTypeChanged fires properly for the guest's 1048 // 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 1049 // 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. 1050 // make sure it's not TEXT_INPUT_TYPE_NONE.
1009 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Focus_FocusRestored) { 1051 IN_PROC_BROWSER_TEST_F(WebViewInteractiveTest, Focus_FocusRestored) {
1010 TestHelper("testFocusRestored", "web_view/focus", NO_TEST_SERVER); 1052 TestHelper("testFocusRestored", "web_view/focus", NO_TEST_SERVER);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 1201
1160 // Now verify that the selection text propagates properly to RWHV. 1202 // Now verify that the selection text propagates properly to RWHV.
1161 content::RenderWidgetHostView* guest_rwhv = 1203 content::RenderWidgetHostView* guest_rwhv =
1162 guest_web_contents()->GetRenderWidgetHostView(); 1204 guest_web_contents()->GetRenderWidgetHostView();
1163 ASSERT_TRUE(guest_rwhv); 1205 ASSERT_TRUE(guest_rwhv);
1164 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); 1206 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText());
1165 ASSERT_TRUE(selected_text.size() >= 10u); 1207 ASSERT_TRUE(selected_text.size() >= 10u);
1166 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); 1208 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10));
1167 } 1209 }
1168 #endif 1210 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698