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

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

Issue 2799803002: Add a test for webview using a blob URL while at a webview-accessible resource. (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/load_webview_accessible_resource/embedder.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <queue> 5 #include <queue>
6 #include <set> 6 #include <set>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 3300 matching lines...) Expand 10 before | Expand all | Expand 10 after
3311 GetGuestViewManager()->GetLastGuestCreated(); 3311 GetGuestViewManager()->GetLastGuestCreated();
3312 ASSERT_TRUE(embedder_contents); 3312 ASSERT_TRUE(embedder_contents);
3313 ASSERT_TRUE(web_view_contents); 3313 ASSERT_TRUE(web_view_contents);
3314 3314
3315 GURL embedder_url(embedder_contents->GetLastCommittedURL()); 3315 GURL embedder_url(embedder_contents->GetLastCommittedURL());
3316 GURL webview_url(embedder_url.GetOrigin().spec() + "assets/foo.html"); 3316 GURL webview_url(embedder_url.GetOrigin().spec() + "assets/foo.html");
3317 3317
3318 EXPECT_EQ(webview_url, web_view_contents->GetLastCommittedURL()); 3318 EXPECT_EQ(webview_url, web_view_contents->GetLastCommittedURL());
3319 } 3319 }
3320 3320
3321 // Tests that a WebView can navigate an iframe to a blob URL that it creates
3322 // while its main frame is at a WebView accessible resource.
3323 IN_PROC_BROWSER_TEST_P(WebViewTest, BlobInWebviewAccessibleResource) {
3324 TestHelper("testBlobInWebviewAccessibleResource",
3325 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER);
3326
3327 content::WebContents* embedder_contents = GetEmbedderWebContents();
3328 content::WebContents* web_view_contents =
3329 GetGuestViewManager()->GetLastGuestCreated();
3330 ASSERT_TRUE(embedder_contents);
3331 ASSERT_TRUE(web_view_contents);
3332
3333 GURL embedder_url(embedder_contents->GetLastCommittedURL());
3334 GURL webview_url(embedder_url.GetOrigin().spec() + "assets/foo.html");
3335
3336 EXPECT_EQ(webview_url, web_view_contents->GetLastCommittedURL());
3337
3338 content::RenderFrameHost* main_frame = web_view_contents->GetMainFrame();
3339 content::RenderFrameHost* blob_frame = ChildFrameAt(main_frame, 0);
3340 EXPECT_TRUE(blob_frame->GetLastCommittedURL().SchemeIsBlob());
3341
3342 std::string result;
3343 EXPECT_TRUE(ExecuteScriptAndExtractString(
3344 blob_frame,
3345 "window.domAutomationController.send(document.body.innerText);",
3346 &result));
3347 EXPECT_EQ("Blob content", result);
3348 }
3349
3321 // Tests that a WebView cannot load a webview-inaccessible resource. See 3350 // Tests that a WebView cannot load a webview-inaccessible resource. See
3322 // https://crbug.com/640072. 3351 // https://crbug.com/640072.
3323 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewInaccessibleResource) { 3352 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewInaccessibleResource) {
3324 TestHelper("testLoadWebviewInaccessibleResource", 3353 TestHelper("testLoadWebviewInaccessibleResource",
3325 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER); 3354 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER);
3326 3355
3327 content::WebContents* embedder_contents = GetEmbedderWebContents(); 3356 content::WebContents* embedder_contents = GetEmbedderWebContents();
3328 content::WebContents* web_view_contents = 3357 content::WebContents* web_view_contents =
3329 GetGuestViewManager()->GetLastGuestCreated(); 3358 GetGuestViewManager()->GetLastGuestCreated();
3330 ASSERT_TRUE(embedder_contents); 3359 ASSERT_TRUE(embedder_contents);
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
4008 ClosingChromeSignInShouldNotCrash) { 4037 ClosingChromeSignInShouldNotCrash) {
4009 GURL signin_url{"chrome://chrome-signin"}; 4038 GURL signin_url{"chrome://chrome-signin"};
4010 4039
4011 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED); 4040 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED);
4012 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED); 4041 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED);
4013 WaitForWebViewInDom(); 4042 WaitForWebViewInDom();
4014 4043
4015 chrome::CloseTab(browser()); 4044 chrome::CloseTab(browser());
4016 } 4045 }
4017 #endif 4046 #endif
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/platform_apps/web_view/load_webview_accessible_resource/embedder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698