| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 "net/url_request/url_request_unittest.h" | 5 #include "net/url_request/url_request_unittest.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 EXPECT_TRUE(r.is_pending()); | 709 EXPECT_TRUE(r.is_pending()); |
| 710 | 710 |
| 711 MessageLoop::current()->Run(); | 711 MessageLoop::current()->Run(); |
| 712 | 712 |
| 713 EXPECT_TRUE(!r.is_pending()); | 713 EXPECT_TRUE(!r.is_pending()); |
| 714 EXPECT_FALSE(d.received_data_before_response()); | 714 EXPECT_FALSE(d.received_data_before_response()); |
| 715 EXPECT_EQ(d.bytes_received(), 0); | 715 EXPECT_EQ(d.bytes_received(), 0); |
| 716 } | 716 } |
| 717 } | 717 } |
| 718 | 718 |
| 719 TEST_F(URLRequestTest, DataURLImageTest) { |
| 720 TestDelegate d; |
| 721 { |
| 722 // Use our nice little Chrome logo. |
| 723 TestURLRequest r(GURL( |
| 724 "data:image/png;base64," |
| 725 "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAADVklEQVQ4jX2TfUwUBBjG3" |
| 726 "w1y+HGcd9dxhXR8T4awOccJGgOSWclHImznLkTlSw0DDQXkrmgYgbUYnlQTqQxIEVxitD" |
| 727 "5UMCATRA1CEEg+Qjw3bWDxIauJv/5oumqs39/P827vnucRmYN0gyF01GI5MpCVdW0gO7t" |
| 728 "vNC+vqSEtbZefk5NuLv1jdJ46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bk0AAAAASUVORK5CYII="), |
| 743 &d); |
| 744 |
| 745 r.Start(); |
| 746 EXPECT_TRUE(r.is_pending()); |
| 747 |
| 748 MessageLoop::current()->Run(); |
| 749 |
| 750 EXPECT_TRUE(!r.is_pending()); |
| 751 EXPECT_FALSE(d.received_data_before_response()); |
| 752 EXPECT_EQ(d.bytes_received(), 911); |
| 753 } |
| 754 } |
| 755 |
| 719 TEST_F(URLRequestTest, FileTest) { | 756 TEST_F(URLRequestTest, FileTest) { |
| 720 FilePath app_path; | 757 FilePath app_path; |
| 721 PathService::Get(base::FILE_EXE, &app_path); | 758 PathService::Get(base::FILE_EXE, &app_path); |
| 722 GURL app_url = net::FilePathToFileURL(app_path); | 759 GURL app_url = net::FilePathToFileURL(app_path); |
| 723 | 760 |
| 724 TestDelegate d; | 761 TestDelegate d; |
| 725 { | 762 { |
| 726 TestURLRequest r(app_url, &d); | 763 TestURLRequest r(app_url, &d); |
| 727 | 764 |
| 728 r.Start(); | 765 r.Start(); |
| (...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2271 TEST_F(URLRequestTestHTTP, OverrideAcceptCharset) { | 2308 TEST_F(URLRequestTestHTTP, OverrideAcceptCharset) { |
| 2272 ASSERT_TRUE(NULL != server_.get()); | 2309 ASSERT_TRUE(NULL != server_.get()); |
| 2273 TestDelegate d; | 2310 TestDelegate d; |
| 2274 TestURLRequest req(server_->TestServerPage("echoheader?Accept-Charset"), &d); | 2311 TestURLRequest req(server_->TestServerPage("echoheader?Accept-Charset"), &d); |
| 2275 req.set_context(new URLRequestTestContext()); | 2312 req.set_context(new URLRequestTestContext()); |
| 2276 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); | 2313 req.SetExtraRequestHeaders("Accept-Charset: koi-8r"); |
| 2277 req.Start(); | 2314 req.Start(); |
| 2278 MessageLoop::current()->Run(); | 2315 MessageLoop::current()->Run(); |
| 2279 EXPECT_EQ(std::string("koi-8r"), d.data_received()); | 2316 EXPECT_EQ(std::string("koi-8r"), d.data_received()); |
| 2280 } | 2317 } |
| OLD | NEW |