OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 | 1231 |
1232 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { | 1232 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { |
1233 public: | 1233 public: |
1234 virtual WebNavigationPolicy decidePolicyForNavigation( | 1234 virtual WebNavigationPolicy decidePolicyForNavigation( |
1235 WebFrame*, const WebURLRequest&, WebNavigationType, | 1235 WebFrame*, const WebURLRequest&, WebNavigationType, |
1236 WebNavigationPolicy defaultPolicy, bool isRedirect) | 1236 WebNavigationPolicy defaultPolicy, bool isRedirect) |
1237 { | 1237 { |
1238 EXPECT_FALSE(isRedirect); | 1238 EXPECT_FALSE(isRedirect); |
1239 return WebNavigationPolicyCurrentTab; | 1239 return WebNavigationPolicyCurrentTab; |
1240 } | 1240 } |
| 1241 |
| 1242 virtual WebURLError cancelledError(WebFrame*, const WebURLRequest& request) |
| 1243 { |
| 1244 // Return a dummy error so the DocumentLoader doesn't assert when |
| 1245 // the reload cancels it. |
| 1246 WebURLError webURLError; |
| 1247 webURLError.domain = ""; |
| 1248 webURLError.reason = 1; |
| 1249 webURLError.isCancellation = true; |
| 1250 webURLError.unreachableURL = WebURL(); |
| 1251 return webURLError; |
| 1252 } |
1241 }; | 1253 }; |
1242 | 1254 |
1243 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) | 1255 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) |
1244 { | 1256 { |
1245 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 1257 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
1246 // would sometimes call decidePolicyForNavigation with isRedirect=true | 1258 // would sometimes call decidePolicyForNavigation with isRedirect=true |
1247 registerMockedHttpURLLoad("form.html"); | 1259 registerMockedHttpURLLoad("form.html"); |
1248 | 1260 |
1249 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 1261 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
1250 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); | 1262 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2815 EXPECT_FALSE(client.wasProgrammaticScroll()); | 2827 EXPECT_FALSE(client.wasProgrammaticScroll()); |
2816 EXPECT_TRUE(client.wasUserScroll()); | 2828 EXPECT_TRUE(client.wasUserScroll()); |
2817 client.reset(); | 2829 client.reset(); |
2818 | 2830 |
2819 m_webView->close(); | 2831 m_webView->close(); |
2820 m_webView = 0; | 2832 m_webView = 0; |
2821 } | 2833 } |
2822 | 2834 |
2823 | 2835 |
2824 } // namespace | 2836 } // namespace |
OLD | NEW |