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

Side by Side Diff: chrome/browser/net/errorpage_browsertest.cc

Issue 2917133002: Perform redirect checks before OnReceivedRedirect in //net. (Closed)
Patch Set: nasko 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
« no previous file with comments | « no previous file | components/error_page/common/localized_error.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <memory> 5 #include <memory>
6 #include <utility> 6 #include <utility>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 } 1508 }
1509 1509
1510 // Make sure HTTP/0.9 is disabled on non-default ports by default. 1510 // Make sure HTTP/0.9 is disabled on non-default ports by default.
1511 IN_PROC_BROWSER_TEST_F(ErrorPageTest, Http09WeirdPort) { 1511 IN_PROC_BROWSER_TEST_F(ErrorPageTest, Http09WeirdPort) {
1512 ASSERT_TRUE(embedded_test_server()->Start()); 1512 ASSERT_TRUE(embedded_test_server()->Start());
1513 ui_test_utils::NavigateToURL( 1513 ui_test_utils::NavigateToURL(
1514 browser(), embedded_test_server()->GetURL("/echo-raw?spam")); 1514 browser(), embedded_test_server()->GetURL("/echo-raw?spam"));
1515 ExpectDisplayingLocalErrorPage(browser(), net::ERR_INVALID_HTTP_RESPONSE); 1515 ExpectDisplayingLocalErrorPage(browser(), net::ERR_INVALID_HTTP_RESPONSE);
1516 } 1516 }
1517 1517
1518 // Test that redirects to invalid URLs show an error. See
1519 // https://crbug.com/462272.
1520 IN_PROC_BROWSER_TEST_F(ErrorPageTest, RedirectToInvalidURL) {
1521 ASSERT_TRUE(embedded_test_server()->Start());
1522 GURL url = embedded_test_server()->GetURL("/server-redirect?https://:");
1523 ui_test_utils::NavigateToURL(browser(), url);
1524 ExpectDisplayingLocalErrorPage(browser(), net::ERR_INVALID_REDIRECT);
1525 // The error page should commit before the redirect, not after.
1526 EXPECT_EQ(url, browser()
1527 ->tab_strip_model()
1528 ->GetActiveWebContents()
1529 ->GetLastCommittedURL());
1530 }
1531
1518 class ErrorPageWithHttp09OnNonDefaultPortsTest : public InProcessBrowserTest { 1532 class ErrorPageWithHttp09OnNonDefaultPortsTest : public InProcessBrowserTest {
1519 public: 1533 public:
1520 // InProcessBrowserTest: 1534 // InProcessBrowserTest:
1521 void SetUp() override { 1535 void SetUp() override {
1522 EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_)) 1536 EXPECT_CALL(policy_provider_, IsInitializationComplete(testing::_))
1523 .WillRepeatedly(testing::Return(true)); 1537 .WillRepeatedly(testing::Return(true));
1524 policy::PolicyMap values; 1538 policy::PolicyMap values;
1525 values.Set(policy::key::kHttp09OnNonDefaultPortsEnabled, 1539 values.Set(policy::key::kHttp09OnNonDefaultPortsEnabled,
1526 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE, 1540 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_MACHINE,
1527 policy::POLICY_SOURCE_CLOUD, 1541 policy::POLICY_SOURCE_CLOUD,
(...skipping 14 matching lines...) Expand all
1542 Http09WeirdPortEnabled) { 1556 Http09WeirdPortEnabled) {
1543 const char kHttp09Response[] = "JumboShrimp"; 1557 const char kHttp09Response[] = "JumboShrimp";
1544 ASSERT_TRUE(embedded_test_server()->Start()); 1558 ASSERT_TRUE(embedded_test_server()->Start());
1545 ui_test_utils::NavigateToURL( 1559 ui_test_utils::NavigateToURL(
1546 browser(), embedded_test_server()->GetURL(std::string("/echo-raw?") + 1560 browser(), embedded_test_server()->GetURL(std::string("/echo-raw?") +
1547 kHttp09Response)); 1561 kHttp09Response));
1548 EXPECT_TRUE(IsDisplayingText(browser(), kHttp09Response)); 1562 EXPECT_TRUE(IsDisplayingText(browser(), kHttp09Response));
1549 } 1563 }
1550 1564
1551 } // namespace 1565 } // namespace
OLDNEW
« no previous file with comments | « no previous file | components/error_page/common/localized_error.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698