OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 #include <windows.h> | 9 #include <windows.h> |
10 #endif | 10 #endif |
(...skipping 2455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2466 EXPECT_FALSE(ContainsString(data, "Content-Type:")); | 2466 EXPECT_FALSE(ContainsString(data, "Content-Type:")); |
2467 EXPECT_FALSE(ContainsString(data, "Origin:")); | 2467 EXPECT_FALSE(ContainsString(data, "Origin:")); |
2468 | 2468 |
2469 // These extra request headers should not have been stripped. | 2469 // These extra request headers should not have been stripped. |
2470 EXPECT_TRUE(ContainsString(data, "Accept:")); | 2470 EXPECT_TRUE(ContainsString(data, "Accept:")); |
2471 EXPECT_TRUE(ContainsString(data, "Accept-Language:")); | 2471 EXPECT_TRUE(ContainsString(data, "Accept-Language:")); |
2472 EXPECT_TRUE(ContainsString(data, "Accept-Charset:")); | 2472 EXPECT_TRUE(ContainsString(data, "Accept-Charset:")); |
2473 } | 2473 } |
2474 | 2474 |
2475 // The following tests check that we handle mutating the request method for | 2475 // The following tests check that we handle mutating the request method for |
2476 // HTTP redirects as expected. See http://crbug.com/56373. | 2476 // HTTP redirects as expected. |
| 2477 // See http://crbug.com/56373 and http://crbug.com/102130. |
2477 | 2478 |
2478 TEST_F(URLRequestTestHTTP, Redirect301Tests) { | 2479 TEST_F(URLRequestTestHTTP, Redirect301Tests) { |
2479 ASSERT_TRUE(test_server_.Start()); | 2480 ASSERT_TRUE(test_server_.Start()); |
2480 | 2481 |
2481 const GURL url = test_server_.GetURL("files/redirect301-to-echo"); | 2482 const GURL url = test_server_.GetURL("files/redirect301-to-echo"); |
2482 | 2483 |
2483 HTTPRedirectMethodTest(url, "POST", "GET", true); | 2484 HTTPRedirectMethodTest(url, "POST", "GET", true); |
2484 HTTPRedirectMethodTest(url, "PUT", "PUT", true); | 2485 HTTPRedirectMethodTest(url, "PUT", "PUT", true); |
| 2486 HTTPRedirectMethodTest(url, "HEAD", "HEAD", false); |
2485 } | 2487 } |
2486 | 2488 |
2487 TEST_F(URLRequestTestHTTP, Redirect302Tests) { | 2489 TEST_F(URLRequestTestHTTP, Redirect302Tests) { |
2488 ASSERT_TRUE(test_server_.Start()); | 2490 ASSERT_TRUE(test_server_.Start()); |
2489 | 2491 |
2490 const GURL url = test_server_.GetURL("files/redirect302-to-echo"); | 2492 const GURL url = test_server_.GetURL("files/redirect302-to-echo"); |
2491 | 2493 |
2492 HTTPRedirectMethodTest(url, "POST", "GET", true); | 2494 HTTPRedirectMethodTest(url, "POST", "GET", true); |
2493 HTTPRedirectMethodTest(url, "PUT", "PUT", true); | 2495 HTTPRedirectMethodTest(url, "PUT", "PUT", true); |
| 2496 HTTPRedirectMethodTest(url, "HEAD", "HEAD", false); |
2494 } | 2497 } |
2495 | 2498 |
2496 TEST_F(URLRequestTestHTTP, Redirect303Tests) { | 2499 TEST_F(URLRequestTestHTTP, Redirect303Tests) { |
2497 ASSERT_TRUE(test_server_.Start()); | 2500 ASSERT_TRUE(test_server_.Start()); |
2498 | 2501 |
2499 const GURL url = test_server_.GetURL("files/redirect303-to-echo"); | 2502 const GURL url = test_server_.GetURL("files/redirect303-to-echo"); |
2500 | 2503 |
2501 HTTPRedirectMethodTest(url, "POST", "GET", true); | 2504 HTTPRedirectMethodTest(url, "POST", "GET", true); |
2502 HTTPRedirectMethodTest(url, "PUT", "GET", true); | 2505 HTTPRedirectMethodTest(url, "PUT", "GET", true); |
| 2506 HTTPRedirectMethodTest(url, "HEAD", "HEAD", false); |
2503 } | 2507 } |
2504 | 2508 |
2505 TEST_F(URLRequestTestHTTP, Redirect307Tests) { | 2509 TEST_F(URLRequestTestHTTP, Redirect307Tests) { |
2506 ASSERT_TRUE(test_server_.Start()); | 2510 ASSERT_TRUE(test_server_.Start()); |
2507 | 2511 |
2508 const GURL url = test_server_.GetURL("files/redirect307-to-echo"); | 2512 const GURL url = test_server_.GetURL("files/redirect307-to-echo"); |
2509 | 2513 |
2510 HTTPRedirectMethodTest(url, "POST", "POST", true); | 2514 HTTPRedirectMethodTest(url, "POST", "POST", true); |
2511 HTTPRedirectMethodTest(url, "PUT", "PUT", true); | 2515 HTTPRedirectMethodTest(url, "PUT", "PUT", true); |
| 2516 HTTPRedirectMethodTest(url, "HEAD", "HEAD", false); |
2512 } | 2517 } |
2513 | 2518 |
2514 TEST_F(URLRequestTestHTTP, InterceptPost302RedirectGet) { | 2519 TEST_F(URLRequestTestHTTP, InterceptPost302RedirectGet) { |
2515 ASSERT_TRUE(test_server_.Start()); | 2520 ASSERT_TRUE(test_server_.Start()); |
2516 | 2521 |
2517 const char kData[] = "hello world"; | 2522 const char kData[] = "hello world"; |
2518 | 2523 |
2519 TestDelegate d; | 2524 TestDelegate d; |
2520 TestURLRequest req(test_server_.GetURL("empty.html"), &d); | 2525 TestURLRequest req(test_server_.GetURL("empty.html"), &d); |
2521 req.set_context(default_context_); | 2526 req.set_context(default_context_); |
(...skipping 1095 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3617 req.SetExtraRequestHeaders(headers); | 3622 req.SetExtraRequestHeaders(headers); |
3618 req.Start(); | 3623 req.Start(); |
3619 MessageLoop::current()->Run(); | 3624 MessageLoop::current()->Run(); |
3620 // If the net tests are being run with ChromeFrame then we need to allow for | 3625 // If the net tests are being run with ChromeFrame then we need to allow for |
3621 // the 'chromeframe' suffix which is added to the user agent before the | 3626 // the 'chromeframe' suffix which is added to the user agent before the |
3622 // closing parentheses. | 3627 // closing parentheses. |
3623 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); | 3628 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); |
3624 } | 3629 } |
3625 | 3630 |
3626 } // namespace net | 3631 } // namespace net |
OLD | NEW |