Index: content/child/web_url_loader_impl_unittest.cc |
diff --git a/content/child/web_url_loader_impl_unittest.cc b/content/child/web_url_loader_impl_unittest.cc |
index e44a000797ed81a2a40f48445e7124e61c2db6dc..d82401c2ddd58b9e5cd6fa9f3431dbb1981f9870 100644 |
--- a/content/child/web_url_loader_impl_unittest.cc |
+++ b/content/child/web_url_loader_impl_unittest.cc |
@@ -507,7 +507,7 @@ TEST_F(WebURLLoaderImplTest, DataURLDeleteOnReceiveData) { |
EXPECT_FALSE(bridge()); |
} |
-TEST_F(WebURLLoaderImplTest, DataURLDeleteOnFinisha) { |
+TEST_F(WebURLLoaderImplTest, DataURLDeleteOnFinish) { |
blink::WebURLRequest request; |
request.initialize(); |
request.setURL(GURL("data:text/html;charset=utf-8,blah!")); |
@@ -520,6 +520,44 @@ TEST_F(WebURLLoaderImplTest, DataURLDeleteOnFinisha) { |
EXPECT_FALSE(bridge()); |
} |
+TEST_F(WebURLLoaderImplTest, DataURLDefersLoading) { |
+ blink::WebURLRequest request; |
+ request.initialize(); |
+ request.setURL(GURL("data:text/html;charset=utf-8,blah!")); |
+ client()->loader()->loadAsynchronously(request, client()); |
+ |
+ // setDefersLoading() might be called with either false or true in no |
+ // specific order. The user of the API will not have sufficient information |
+ // about the WebURLLoader's internal state, so the latter gracefully needs to |
+ // handle calling setDefersLoading any number of times with any values from |
+ // any point in time. |
+ |
+ client()->loader()->setDefersLoading(false); |
+ client()->loader()->setDefersLoading(true); |
+ client()->loader()->setDefersLoading(true); |
+ message_loop()->RunUntilIdle(); |
+ EXPECT_FALSE(client()->did_finish()); |
+ |
+ client()->loader()->setDefersLoading(false); |
+ client()->loader()->setDefersLoading(true); |
+ message_loop()->RunUntilIdle(); |
+ EXPECT_FALSE(client()->did_finish()); |
+ |
+ client()->loader()->setDefersLoading(false); |
+ message_loop()->RunUntilIdle(); |
+ EXPECT_TRUE(client()->did_finish()); |
+ |
+ client()->loader()->setDefersLoading(true); |
+ client()->loader()->setDefersLoading(false); |
+ client()->loader()->setDefersLoading(false); |
+ message_loop()->RunUntilIdle(); |
+ EXPECT_TRUE(client()->did_finish()); |
+ |
+ EXPECT_EQ("blah!", client()->received_data()); |
+ EXPECT_EQ(net::OK, client()->error().reason); |
+ EXPECT_EQ("", client()->error().domain.utf8()); |
+} |
+ |
// FTP integration tests. These are focused more on safe deletion than correct |
// parsing of FTP responses. |