OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/loader/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 | 42 |
43 scoped_ptr<net::test_server::HttpResponse> HandlePostAndRedirectURLs( | 43 scoped_ptr<net::test_server::HttpResponse> HandlePostAndRedirectURLs( |
44 const std::string& request_path, | 44 const std::string& request_path, |
45 const net::test_server::HttpRequest& request) { | 45 const net::test_server::HttpRequest& request) { |
46 scoped_ptr<net::test_server::BasicHttpResponse> http_response( | 46 scoped_ptr<net::test_server::BasicHttpResponse> http_response( |
47 new net::test_server::BasicHttpResponse()); | 47 new net::test_server::BasicHttpResponse()); |
48 if (base::StartsWith(request.relative_url, kRedirectPostPath, | 48 if (base::StartsWith(request.relative_url, kRedirectPostPath, |
49 base::CompareCase::SENSITIVE)) { | 49 base::CompareCase::SENSITIVE)) { |
50 http_response->set_code(net::HTTP_TEMPORARY_REDIRECT); | 50 http_response->set_code(net::HTTP_TEMPORARY_REDIRECT); |
51 http_response->AddCustomHeader("Location", kPostPath); | 51 http_response->AddCustomHeader("Location", kPostPath); |
52 EXPECT_EQ(request.content.length(), kPayloadSize);; | 52 EXPECT_EQ(request.content.length(), kPayloadSize); |
53 return std::move(http_response); | 53 return std::move(http_response); |
54 } else if(base::StartsWith(request.relative_url, kPostPath, | 54 } else if (base::StartsWith(request.relative_url, kPostPath, |
55 base::CompareCase::SENSITIVE)) { | 55 base::CompareCase::SENSITIVE)) { |
56 http_response->set_content("hello"); | 56 http_response->set_content("hello"); |
57 http_response->set_content_type("text/plain"); | 57 http_response->set_content_type("text/plain"); |
58 EXPECT_EQ(request.content.length(), kPayloadSize); | 58 EXPECT_EQ(request.content.length(), kPayloadSize); |
59 return std::move(http_response); | 59 return std::move(http_response); |
60 } else { | 60 } else { |
61 return scoped_ptr<net::test_server::HttpResponse>(); | 61 return scoped_ptr<net::test_server::HttpResponse>(); |
62 } | 62 } |
63 } | 63 } |
64 | 64 |
65 } // namespace | 65 } // namespace |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 EXPECT_TRUE(ExecuteScriptAndExtractString( | 100 EXPECT_TRUE(ExecuteScriptAndExtractString( |
101 shell()->web_contents(), | 101 shell()->web_contents(), |
102 base::StringPrintf("WaitForAsyncXHR('%s', %" PRIuS ")", | 102 base::StringPrintf("WaitForAsyncXHR('%s', %" PRIuS ")", |
103 kRedirectPostPath, | 103 kRedirectPostPath, |
104 kPayloadSize), | 104 kPayloadSize), |
105 &js_result)); | 105 &js_result)); |
106 EXPECT_EQ(js_result, "success"); | 106 EXPECT_EQ(js_result, "success"); |
107 } | 107 } |
108 | 108 |
109 } // namespace content | 109 } // namespace content |
OLD | NEW |