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

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

Issue 89243003: Move EmptyString, kWhitespace and the BOM to base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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
« no previous file with comments | « net/url_request/url_request_test_util.cc ('k') | testing/android/native_test_util.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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #endif 10 #endif
(...skipping 5670 matching lines...) Expand 10 before | Expand all | Expand 10 after
5681 req.Start(); 5681 req.Start();
5682 base::RunLoop().Run(); 5682 base::RunLoop().Run();
5683 EXPECT_EQ("POST", req.method()); 5683 EXPECT_EQ("POST", req.method());
5684 EXPECT_EQ(kData, d.data_received()); 5684 EXPECT_EQ(kData, d.data_received());
5685 } 5685 }
5686 5686
5687 // Check that default A-L header is sent. 5687 // Check that default A-L header is sent.
5688 TEST_F(URLRequestTestHTTP, DefaultAcceptLanguage) { 5688 TEST_F(URLRequestTestHTTP, DefaultAcceptLanguage) {
5689 ASSERT_TRUE(test_server_.Start()); 5689 ASSERT_TRUE(test_server_.Start());
5690 5690
5691 StaticHttpUserAgentSettings settings("en", EmptyString()); 5691 StaticHttpUserAgentSettings settings("en", std::string());
5692 TestNetworkDelegate network_delegate; // Must outlive URLRequests. 5692 TestNetworkDelegate network_delegate; // Must outlive URLRequests.
5693 TestURLRequestContext context(true); 5693 TestURLRequestContext context(true);
5694 context.set_network_delegate(&network_delegate); 5694 context.set_network_delegate(&network_delegate);
5695 context.set_http_user_agent_settings(&settings); 5695 context.set_http_user_agent_settings(&settings);
5696 context.Init(); 5696 context.Init();
5697 5697
5698 TestDelegate d; 5698 TestDelegate d;
5699 URLRequest req(test_server_.GetURL("echoheader?Accept-Language"), 5699 URLRequest req(test_server_.GetURL("echoheader?Accept-Language"),
5700 DEFAULT_PRIORITY, 5700 DEFAULT_PRIORITY,
5701 &d, 5701 &d,
5702 &context); 5702 &context);
5703 req.Start(); 5703 req.Start();
5704 base::RunLoop().Run(); 5704 base::RunLoop().Run();
5705 EXPECT_EQ("en", d.data_received()); 5705 EXPECT_EQ("en", d.data_received());
5706 } 5706 }
5707 5707
5708 // Check that an empty A-L header is not sent. http://crbug.com/77365. 5708 // Check that an empty A-L header is not sent. http://crbug.com/77365.
5709 TEST_F(URLRequestTestHTTP, EmptyAcceptLanguage) { 5709 TEST_F(URLRequestTestHTTP, EmptyAcceptLanguage) {
5710 ASSERT_TRUE(test_server_.Start()); 5710 ASSERT_TRUE(test_server_.Start());
5711 5711
5712 StaticHttpUserAgentSettings settings(EmptyString(), EmptyString()); 5712 std::string empty_string; // Avoid most vexing parse on line below.
5713 StaticHttpUserAgentSettings settings(empty_string, empty_string);
5713 TestNetworkDelegate network_delegate; // Must outlive URLRequests. 5714 TestNetworkDelegate network_delegate; // Must outlive URLRequests.
5714 TestURLRequestContext context(true); 5715 TestURLRequestContext context(true);
5715 context.set_network_delegate(&network_delegate); 5716 context.set_network_delegate(&network_delegate);
5716 context.Init(); 5717 context.Init();
5717 // We override the language after initialization because empty entries 5718 // We override the language after initialization because empty entries
5718 // get overridden by Init(). 5719 // get overridden by Init().
5719 context.set_http_user_agent_settings(&settings); 5720 context.set_http_user_agent_settings(&settings);
5720 5721
5721 TestDelegate d; 5722 TestDelegate d;
5722 URLRequest req(test_server_.GetURL("echoheader?Accept-Language"), 5723 URLRequest req(test_server_.GetURL("echoheader?Accept-Language"),
(...skipping 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after
7343 7344
7344 EXPECT_FALSE(r.is_pending()); 7345 EXPECT_FALSE(r.is_pending());
7345 EXPECT_EQ(1, d->response_started_count()); 7346 EXPECT_EQ(1, d->response_started_count());
7346 EXPECT_FALSE(d->received_data_before_response()); 7347 EXPECT_FALSE(d->received_data_before_response());
7347 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size)); 7348 EXPECT_EQ(d->bytes_received(), static_cast<int>(file_size));
7348 } 7349 }
7349 } 7350 }
7350 #endif // !defined(DISABLE_FTP_SUPPORT) 7351 #endif // !defined(DISABLE_FTP_SUPPORT)
7351 7352
7352 } // namespace net 7353 } // namespace net
OLDNEW
« no previous file with comments | « net/url_request/url_request_test_util.cc ('k') | testing/android/native_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698