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

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

Issue 2768863003: Fix webview-accessible resource checks in AllowCrossRendererResourceLoadHelper (Closed)
Patch Set: Cleanup Created 3 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 <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 3292 matching lines...) Expand 10 before | Expand all | Expand 10 after
3303 GetGuestViewManager()->GetLastGuestCreated(); 3303 GetGuestViewManager()->GetLastGuestCreated();
3304 ASSERT_TRUE(embedder_contents); 3304 ASSERT_TRUE(embedder_contents);
3305 ASSERT_TRUE(web_view_contents); 3305 ASSERT_TRUE(web_view_contents);
3306 3306
3307 GURL embedder_url(embedder_contents->GetLastCommittedURL()); 3307 GURL embedder_url(embedder_contents->GetLastCommittedURL());
3308 GURL webview_url(embedder_url.GetOrigin().spec() + "assets/foo.html"); 3308 GURL webview_url(embedder_url.GetOrigin().spec() + "assets/foo.html");
3309 3309
3310 EXPECT_EQ(webview_url, web_view_contents->GetLastCommittedURL()); 3310 EXPECT_EQ(webview_url, web_view_contents->GetLastCommittedURL());
3311 } 3311 }
3312 3312
3313 // Tests that a WebView cannot load a webview-inaccessible resource. See
3314 // https://crbug.com/640072.
3315 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewInaccessibleResource) {
3316 TestHelper("testLoadWebviewInaccessibleResource",
3317 "web_view/load_webview_accessible_resource", NEEDS_TEST_SERVER);
3318
3319 content::WebContents* embedder_contents = GetEmbedderWebContents();
3320 content::WebContents* web_view_contents =
3321 GetGuestViewManager()->GetLastGuestCreated();
3322 ASSERT_TRUE(embedder_contents);
3323 ASSERT_TRUE(web_view_contents);
3324
3325 // Check that the webview stays at the first page that it loaded (foo.html),
3326 // and does not commit inaccessible.html.
3327 GURL embedder_url(embedder_contents->GetLastCommittedURL());
3328 GURL foo_url(embedder_url.GetOrigin().spec() + "assets/foo.html");
3329
3330 EXPECT_EQ(foo_url, web_view_contents->GetLastCommittedURL());
3331 }
3332
3313 // Tests that a webview inside an iframe can load and that it is destroyed when 3333 // Tests that a webview inside an iframe can load and that it is destroyed when
3314 // the iframe is detached. 3334 // the iframe is detached.
3315 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewInsideIframe) { 3335 IN_PROC_BROWSER_TEST_P(WebViewTest, LoadWebviewInsideIframe) {
3316 TestHelper("testLoadWebviewInsideIframe", 3336 TestHelper("testLoadWebviewInsideIframe",
3317 "web_view/load_webview_inside_iframe", NEEDS_TEST_SERVER); 3337 "web_view/load_webview_inside_iframe", NEEDS_TEST_SERVER);
3318 3338
3319 // WebContents is leaked when using BrowserPlugin. 3339 // WebContents is leaked when using BrowserPlugin.
3320 if (!base::FeatureList::IsEnabled(::features::kGuestViewCrossProcessFrames)) 3340 if (!base::FeatureList::IsEnabled(::features::kGuestViewCrossProcessFrames))
3321 return; 3341 return;
3322 3342
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
3980 ClosingChromeSignInShouldNotCrash) { 4000 ClosingChromeSignInShouldNotCrash) {
3981 GURL signin_url{"chrome://chrome-signin"}; 4001 GURL signin_url{"chrome://chrome-signin"};
3982 4002
3983 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED); 4003 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED);
3984 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED); 4004 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED);
3985 WaitForWebViewInDom(); 4005 WaitForWebViewInDom();
3986 4006
3987 chrome::CloseTab(browser()); 4007 chrome::CloseTab(browser());
3988 } 4008 }
3989 #endif 4009 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698