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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 net::EmbeddedTestServer* test_server = embedded_test_server(); | 71 net::EmbeddedTestServer* test_server = embedded_test_server(); |
72 ASSERT_TRUE(test_server->Start()); | 72 ASSERT_TRUE(test_server->Start()); |
73 test_server->RegisterRequestHandler( | 73 test_server->RegisterRequestHandler( |
74 base::Bind(&HandlePostAndRedirectURLs, kPostPath)); | 74 base::Bind(&HandlePostAndRedirectURLs, kPostPath)); |
75 | 75 |
76 NavigateToURL(shell(), | 76 NavigateToURL(shell(), |
77 test_server->GetURL("/loader/async_resource_handler.html")); | 77 test_server->GetURL("/loader/async_resource_handler.html")); |
78 | 78 |
79 std::string js_result; | 79 std::string js_result; |
80 EXPECT_TRUE(ExecuteScriptAndExtractString( | 80 EXPECT_TRUE(ExecuteScriptAndExtractString( |
81 shell()->web_contents(), | 81 shell(), base::StringPrintf("WaitForAsyncXHR('%s', %" PRIuS ")", |
82 base::StringPrintf("WaitForAsyncXHR('%s', %" PRIuS ")", | 82 kPostPath, kPayloadSize), |
83 kPostPath, | |
84 kPayloadSize), | |
85 &js_result)); | 83 &js_result)); |
86 EXPECT_EQ(js_result, "success"); | 84 EXPECT_EQ(js_result, "success"); |
87 } | 85 } |
88 | 86 |
89 IN_PROC_BROWSER_TEST_F(AsyncResourceHandlerBrowserTest, | 87 IN_PROC_BROWSER_TEST_F(AsyncResourceHandlerBrowserTest, |
90 UploadProgressRedirect) { | 88 UploadProgressRedirect) { |
91 net::EmbeddedTestServer* test_server = embedded_test_server(); | 89 net::EmbeddedTestServer* test_server = embedded_test_server(); |
92 ASSERT_TRUE(test_server->Start()); | 90 ASSERT_TRUE(test_server->Start()); |
93 test_server->RegisterRequestHandler( | 91 test_server->RegisterRequestHandler( |
94 base::Bind(&HandlePostAndRedirectURLs, kRedirectPostPath)); | 92 base::Bind(&HandlePostAndRedirectURLs, kRedirectPostPath)); |
95 | 93 |
96 NavigateToURL(shell(), | 94 NavigateToURL(shell(), |
97 test_server->GetURL("/loader/async_resource_handler.html")); | 95 test_server->GetURL("/loader/async_resource_handler.html")); |
98 | 96 |
99 std::string js_result; | 97 std::string js_result; |
100 EXPECT_TRUE(ExecuteScriptAndExtractString( | 98 EXPECT_TRUE(ExecuteScriptAndExtractString( |
101 shell()->web_contents(), | 99 shell(), base::StringPrintf("WaitForAsyncXHR('%s', %" PRIuS ")", |
102 base::StringPrintf("WaitForAsyncXHR('%s', %" PRIuS ")", | 100 kRedirectPostPath, kPayloadSize), |
103 kRedirectPostPath, | |
104 kPayloadSize), | |
105 &js_result)); | 101 &js_result)); |
106 EXPECT_EQ(js_result, "success"); | 102 EXPECT_EQ(js_result, "success"); |
107 } | 103 } |
108 | 104 |
109 } // namespace content | 105 } // namespace content |
OLD | NEW |