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 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1301 | 1301 |
1302 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { | 1302 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { |
1303 public: | 1303 public: |
1304 virtual WebNavigationPolicy decidePolicyForNavigation( | 1304 virtual WebNavigationPolicy decidePolicyForNavigation( |
1305 WebFrame*, const WebURLRequest&, WebNavigationType, | 1305 WebFrame*, const WebURLRequest&, WebNavigationType, |
1306 WebNavigationPolicy defaultPolicy, bool isRedirect) | 1306 WebNavigationPolicy defaultPolicy, bool isRedirect) |
1307 { | 1307 { |
1308 EXPECT_FALSE(isRedirect); | 1308 EXPECT_FALSE(isRedirect); |
1309 return WebNavigationPolicyCurrentTab; | 1309 return WebNavigationPolicyCurrentTab; |
1310 } | 1310 } |
1311 | |
1312 virtual WebURLError cancelledError(WebFrame*, const WebURLRequest& request) | |
1313 { | |
1314 // Return a dummy error so the DocumentLoader doesn't assert when | |
1315 // the reload cancels it. | |
1316 WebURLError webURLError; | |
1317 webURLError.domain = ""; | |
1318 webURLError.reason = 1; | |
1319 webURLError.isCancellation = true; | |
1320 webURLError.unreachableURL = WebURL(); | |
1321 return webURLError; | |
1322 } | |
1323 }; | 1311 }; |
1324 | 1312 |
1325 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) | 1313 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) |
1326 { | 1314 { |
1327 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 1315 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
1328 // would sometimes call decidePolicyForNavigation with isRedirect=true | 1316 // would sometimes call decidePolicyForNavigation with isRedirect=true |
1329 registerMockedHttpURLLoad("form.html"); | 1317 registerMockedHttpURLLoad("form.html"); |
1330 | 1318 |
1331 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 1319 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
1332 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); | 1320 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); |
(...skipping 1564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2897 EXPECT_FALSE(client.wasProgrammaticScroll()); | 2885 EXPECT_FALSE(client.wasProgrammaticScroll()); |
2898 EXPECT_TRUE(client.wasUserScroll()); | 2886 EXPECT_TRUE(client.wasUserScroll()); |
2899 client.reset(); | 2887 client.reset(); |
2900 | 2888 |
2901 m_webView->close(); | 2889 m_webView->close(); |
2902 m_webView = 0; | 2890 m_webView = 0; |
2903 } | 2891 } |
2904 | 2892 |
2905 | 2893 |
2906 } // namespace | 2894 } // namespace |
OLD | NEW |