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 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1186 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { | 1186 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { |
1187 public: | 1187 public: |
1188 virtual WebNavigationPolicy decidePolicyForNavigation( | 1188 virtual WebNavigationPolicy decidePolicyForNavigation( |
1189 WebFrame*, const WebURLRequest&, WebNavigationType, | 1189 WebFrame*, const WebURLRequest&, WebNavigationType, |
1190 const WebNode& originatingNode, | 1190 const WebNode& originatingNode, |
1191 WebNavigationPolicy defaultPolicy, bool isRedirect) | 1191 WebNavigationPolicy defaultPolicy, bool isRedirect) |
1192 { | 1192 { |
1193 EXPECT_FALSE(isRedirect); | 1193 EXPECT_FALSE(isRedirect); |
1194 return WebNavigationPolicyCurrentTab; | 1194 return WebNavigationPolicyCurrentTab; |
1195 } | 1195 } |
1196 | |
1197 virtual WebURLError cancelledError(WebFrame*, const WebURLRequest& request) | |
1198 { | |
1199 // Return a dummy error so the DocumentLoader doesn't assert when | |
1200 // the reload cancels it. | |
1201 WebURLError webURLError; | |
1202 webURLError.domain = ""; | |
1203 webURLError.reason = 1; | |
1204 webURLError.isCancellation = true; | |
1205 webURLError.unreachableURL = WebURL(); | |
1206 return webURLError; | |
1207 } | |
1208 }; | 1196 }; |
1209 | 1197 |
1210 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) | 1198 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) |
1211 { | 1199 { |
1212 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 1200 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
1213 // would sometimes call decidePolicyForNavigation with isRedirect=true | 1201 // would sometimes call decidePolicyForNavigation with isRedirect=true |
1214 registerMockedHttpURLLoad("form.html"); | 1202 registerMockedHttpURLLoad("form.html"); |
1215 | 1203 |
1216 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 1204 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
1217 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); | 1205 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2756 EXPECT_FALSE(client.wasProgrammaticScroll()); | 2744 EXPECT_FALSE(client.wasProgrammaticScroll()); |
2757 EXPECT_TRUE(client.wasUserScroll()); | 2745 EXPECT_TRUE(client.wasUserScroll()); |
2758 client.reset(); | 2746 client.reset(); |
2759 | 2747 |
2760 m_webView->close(); | 2748 m_webView->close(); |
2761 m_webView = 0; | 2749 m_webView = 0; |
2762 } | 2750 } |
2763 | 2751 |
2764 | 2752 |
2765 } // namespace | 2753 } // namespace |
OLD | NEW |