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

Side by Side Diff: net/url_request/url_request_unittest.cc

Issue 9307093: Don't use IDENT_SRC_URL for HttpAuth challenges. IE hasn't supported it for years, and at worst ... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 8 years, 10 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 | Annotate | Revision Log
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 "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 2447 matching lines...) Expand 10 before | Expand all | Expand 10 after
2458 r.Start(); 2458 r.Start();
2459 2459
2460 MessageLoop::current()->Run(); 2460 MessageLoop::current()->Run();
2461 2461
2462 EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos); 2462 EXPECT_TRUE(d.data_received().find("user/secret") != std::string::npos);
2463 2463
2464 // Make sure we sent the cookie in the restarted transaction. 2464 // Make sure we sent the cookie in the restarted transaction.
2465 EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true") 2465 EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true")
2466 != std::string::npos); 2466 != std::string::npos);
2467 } 2467 }
2468
2469 // Same test as above, except this time the restart is initiated earlier
2470 // (without user intervention since identity is embedded in the URL).
2471 {
2472 TestNetworkDelegate network_delegate; // must outlive URLRequest
2473 scoped_refptr<TestURLRequestContext> context(
2474 new TestURLRequestContext(true));
2475 context->set_network_delegate(&network_delegate);
2476 context->Init();
2477
2478 TestDelegate d;
2479
2480 GURL::Replacements replacements;
2481 std::string username("user2");
2482 std::string password("secret");
2483 replacements.SetUsernameStr(username);
2484 replacements.SetPasswordStr(password);
2485 GURL url_with_identity = url_requiring_auth.ReplaceComponents(replacements);
2486
2487 URLRequest r(url_with_identity, &d);
2488 r.set_context(context);
2489 r.Start();
2490
2491 MessageLoop::current()->Run();
2492
2493 EXPECT_TRUE(d.data_received().find("user2/secret") != std::string::npos);
2494
2495 // Make sure we sent the cookie in the restarted transaction.
2496 EXPECT_TRUE(d.data_received().find("Cookie: got_challenged=true")
2497 != std::string::npos);
2498 }
2499 } 2468 }
2500 2469
2501 TEST_F(URLRequestTest, DelayedCookieCallback) { 2470 TEST_F(URLRequestTest, DelayedCookieCallback) {
2502 TestServer test_server(TestServer::TYPE_HTTP, FilePath()); 2471 TestServer test_server(TestServer::TYPE_HTTP, FilePath());
2503 ASSERT_TRUE(test_server.Start()); 2472 ASSERT_TRUE(test_server.Start());
2504 2473
2505 scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); 2474 scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
2506 scoped_refptr<DelayedCookieMonster> delayed_cm = 2475 scoped_refptr<DelayedCookieMonster> delayed_cm =
2507 new DelayedCookieMonster(); 2476 new DelayedCookieMonster();
2508 scoped_refptr<CookieStore> cookie_store = delayed_cm; 2477 scoped_refptr<CookieStore> cookie_store = delayed_cm;
(...skipping 1570 matching lines...) Expand 10 before | Expand all | Expand 10 after
4079 req.SetExtraRequestHeaders(headers); 4048 req.SetExtraRequestHeaders(headers);
4080 req.Start(); 4049 req.Start();
4081 MessageLoop::current()->Run(); 4050 MessageLoop::current()->Run();
4082 // If the net tests are being run with ChromeFrame then we need to allow for 4051 // 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 4052 // the 'chromeframe' suffix which is added to the user agent before the
4084 // closing parentheses. 4053 // closing parentheses.
4085 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true)); 4054 EXPECT_TRUE(StartsWithASCII(d.data_received(), "Lynx (textmode", true));
4086 } 4055 }
4087 4056
4088 } // namespace net 4057 } // namespace net
OLDNEW
« net/http/http_auth_controller.cc ('K') | « net/http/http_network_transaction_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698