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

Side by Side Diff: extensions/browser/guest_view/web_view/web_view_apitest.cc

Issue 1582053002: Implement webview.captureVisibleRegion() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test so it waits for the first frame to be generated. Created 4 years, 11 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/browser/guest_view/web_view/web_view_apitest.h" 5 #include "extensions/browser/guest_view/web_view/web_view_apitest.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 729
730 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIGoogleProperty) { 730 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebRequestAPIGoogleProperty) {
731 RunTest("testWebRequestAPIGoogleProperty", "web_view/apitest"); 731 RunTest("testWebRequestAPIGoogleProperty", "web_view/apitest");
732 } 732 }
733 733
734 // This test verifies that webview.contentWindow works inside an iframe 734 // This test verifies that webview.contentWindow works inside an iframe
735 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebViewInsideFrame) { 735 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestWebViewInsideFrame) {
736 LaunchApp("web_view/inside_iframe"); 736 LaunchApp("web_view/inside_iframe");
737 } 737 }
738 738
739 IN_PROC_BROWSER_TEST_F(WebViewAPITest, TestCaptureVisibleRegion) {
740 StartTestServer();
741
742 // Launch the app and wait until it's ready to load a test.
743 LaunchApp("web_view/apitest");
744
745 ExtensionTestMessageListener done_listener("TEST_PASSED", false);
746 done_listener.set_failure_message("TEST_FAILED");
747 // Run the test and wait until the guest WebContents is available and has
748 // finished loading.
749 ExtensionTestMessageListener guest_loaded_listener("guest-loaded", false);
750 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents_,
751 "runTest('testCaptureVisibleRegion')"));
752
753 content::WebContents* guest_web_contents = GetGuestWebContents();
754 EXPECT_TRUE(guest_web_contents->GetRenderProcessHost()->IsForGuestsOnly());
755 ASSERT_TRUE(guest_loaded_listener.WaitUntilSatisfied());
756
757 // Wait for first frame to render before attempting pixel capture.
758 WaitForFirstFrame(guest_web_contents);
Fady Samuel 2016/01/25 16:20:39 This seems like a broken API if we have to do this
759
760 EXPECT_TRUE(content::ExecuteScript(embedder_web_contents_,
761 "captureVisibleRegionDoCapture()"));
762
763 // It would be nice not to replicate this.
764 ASSERT_TRUE(done_listener.WaitUntilSatisfied());
765
766 StopTestServer();
767 }
739 768
740 } // namespace extensions 769 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698