| OLD | NEW |
| 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 "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 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2447 TestNetworkDelegate network_delegate; // must outlive URLRequest | 2447 TestNetworkDelegate network_delegate; // must outlive URLRequest |
| 2448 scoped_refptr<TestURLRequestContext> context( | 2448 scoped_refptr<TestURLRequestContext> context( |
| 2449 new TestURLRequestContext(true)); | 2449 new TestURLRequestContext(true)); |
| 2450 context->set_network_delegate(&network_delegate); | 2450 context->set_network_delegate(&network_delegate); |
| 2451 context->Init(); | 2451 context->Init(); |
| 2452 | 2452 |
| 2453 TestDelegate d; | 2453 TestDelegate d; |
| 2454 d.set_credentials(AuthCredentials(kUser, kSecret)); | 2454 d.set_credentials(AuthCredentials(kUser, kSecret)); |
| 2455 | 2455 |
| 2456 URLRequest r(url_requiring_auth, &d); | 2456 URLRequest r(url_requiring_auth, &d); |
| 2457 r.set_load_flags(LOAD_NORMAL | LOAD_ENABLE_EMBEDDED_IDENTITY); |
| 2457 r.set_context(context); | 2458 r.set_context(context); |
| 2458 r.Start(); | 2459 r.Start(); |
| 2459 | 2460 |
| 2460 MessageLoop::current()->Run(); | 2461 MessageLoop::current()->Run(); |
| 2461 | 2462 |
| 2462 EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); | 2463 EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); |
| 2463 | 2464 |
| 2464 // Make sure we sent the cookie in the restarted transaction. | 2465 // Make sure we sent the cookie in the restarted transaction. |
| 2465 EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true") | 2466 EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true") |
| 2466 != std::string::npos); | 2467 != std::string::npos); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2478 TestDelegate d; | 2479 TestDelegate d; |
| 2479 | 2480 |
| 2480 GURL::Replacements replacements; | 2481 GURL::Replacements replacements; |
| 2481 std::string username("user2"); | 2482 std::string username("user2"); |
| 2482 std::string password("secret"); | 2483 std::string password("secret"); |
| 2483 replacements.SetUsernameStr(username); | 2484 replacements.SetUsernameStr(username); |
| 2484 replacements.SetPasswordStr(password); | 2485 replacements.SetPasswordStr(password); |
| 2485 GURL url_with_identity = url_requiring_auth.ReplaceComponents(replacements); | 2486 GURL url_with_identity = url_requiring_auth.ReplaceComponents(replacements); |
| 2486 | 2487 |
| 2487 URLRequest r(url_with_identity, &d); | 2488 URLRequest r(url_with_identity, &d); |
| 2489 r.set_load_flags(LOAD_NORMAL | LOAD_ENABLE_EMBEDDED_IDENTITY); |
| 2488 r.set_context(context); | 2490 r.set_context(context); |
| 2489 r.Start(); | 2491 r.Start(); |
| 2490 | 2492 |
| 2491 MessageLoop::current()->Run(); | 2493 MessageLoop::current()->Run(); |
| 2492 | 2494 |
| 2493 EXPECT_TRUE(d.data_received().find("user2/secret") != std::string::npos); | 2495 EXPECT_TRUE(d.data_received().find("user2/secret") != std::string::npos); |
| 2494 | 2496 |
| 2495 // Make sure we sent the cookie in the restarted transaction. | 2497 // Make sure we sent the cookie in the restarted transaction. |
| 2496 EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true") | 2498 EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true") |
| 2497 != std::string::npos); | 2499 != std::string::npos); |
| (...skipping 1581 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4079 req.SetExtraRequestHeaders(headers); | 4081 req.SetExtraRequestHeaders(headers); |
| 4080 req.Start(); | 4082 req.Start(); |
| 4081 MessageLoop::current()->Run(); | 4083 MessageLoop::current()->Run(); |
| 4082 // If the net tests are being run with ChromeFrame then we need to allow for | 4084 // If the net tests are being run with ChromeFrame then we need to allow for |
| 4083 // the 'chromeframe' suffix which is added to the user agent before the | 4085 // the 'chromeframe' suffix which is added to the user agent before the |
| 4084 // closing parentheses. | 4086 // closing parentheses. |
| 4085 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); | 4087 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); |
| 4086 } | 4088 } |
| 4087 | 4089 |
| 4088 } // namespace net | 4090 } // namespace net |
| OLD | NEW |