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

Side by Side Diff: content/browser/browser_side_navigation_browsertest.cc

Issue 2917133002: Perform redirect checks before OnReceivedRedirect in //net. (Closed)
Patch Set: mmenke comments Created 3 years, 6 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/test/scoped_feature_list.h" 10 #include "base/test/scoped_feature_list.h"
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 EXPECT_FALSE(NavigateToURL(shell(), redirect_to_blank_url)); 413 EXPECT_FALSE(NavigateToURL(shell(), redirect_to_blank_url));
414 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); 414 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex());
415 EXPECT_EQ(PAGE_TYPE_ERROR, controller.GetLastCommittedEntry()->GetPageType()); 415 EXPECT_EQ(PAGE_TYPE_ERROR, controller.GetLastCommittedEntry()->GetPageType());
416 416
417 TestNavigationObserver reload_observer(shell()->web_contents()); 417 TestNavigationObserver reload_observer(shell()->web_contents());
418 EXPECT_TRUE(ExecuteScript(shell(), "location.reload()")); 418 EXPECT_TRUE(ExecuteScript(shell(), "location.reload()"));
419 reload_observer.Wait(); 419 reload_observer.Wait();
420 420
421 // The expectation is that about:blank was loaded and the virtual URL is set 421 // The expectation is that about:blank was loaded and the virtual URL is set
422 // to the URL that was blocked. 422 // to the URL that was blocked.
423 //
424 // TODO(nasko): Now that the error commits on the previous URL, the blocked
425 // navigation logic is no longer needed.
nasko 2017/06/06 00:27:38 Can you add "See https://crbug.com/723796." so the
davidben 2017/06/06 17:31:08 Done.
423 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex()); 426 EXPECT_EQ(1, controller.GetLastCommittedEntryIndex());
424 EXPECT_FALSE( 427 EXPECT_FALSE(
425 controller.GetLastCommittedEntry()->GetURL().SchemeIs(url::kDataScheme)); 428 controller.GetLastCommittedEntry()->GetURL().SchemeIs(url::kDataScheme));
426 EXPECT_TRUE(controller.GetLastCommittedEntry()->GetVirtualURL().SchemeIs( 429 EXPECT_EQ(redirect_to_blank_url,
427 url::kDataScheme)); 430 controller.GetLastCommittedEntry()->GetVirtualURL());
428 EXPECT_EQ(url::kAboutBlankURL, 431 EXPECT_EQ(url::kAboutBlankURL,
429 controller.GetLastCommittedEntry()->GetURL().spec()); 432 controller.GetLastCommittedEntry()->GetURL().spec());
430 } 433 }
431 434
432 class BrowserSideNavigationBrowserDisableWebSecurityTest 435 class BrowserSideNavigationBrowserDisableWebSecurityTest
433 : public BrowserSideNavigationBrowserTest { 436 : public BrowserSideNavigationBrowserTest {
434 public: 437 public:
435 BrowserSideNavigationBrowserDisableWebSecurityTest() {} 438 BrowserSideNavigationBrowserDisableWebSecurityTest() {}
436 439
437 protected: 440 protected:
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 "xhr.send();\n" 512 "xhr.send();\n"
510 "window.domAutomationController.send(xhr.responseText);", 513 "window.domAutomationController.send(xhr.responseText);",
511 file_url.spec().c_str()); 514 file_url.spec().c_str());
512 std::string result; 515 std::string result;
513 EXPECT_TRUE( 516 EXPECT_TRUE(
514 ExecuteScriptAndExtractString(shell()->web_contents(), script, &result)); 517 ExecuteScriptAndExtractString(shell()->web_contents(), script, &result));
515 EXPECT_TRUE(result.empty()); 518 EXPECT_TRUE(result.empty());
516 } 519 }
517 520
518 } // namespace content 521 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698