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 1104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1115 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { | 1115 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { |
1116 public: | 1116 public: |
1117 virtual WebNavigationPolicy decidePolicyForNavigation( | 1117 virtual WebNavigationPolicy decidePolicyForNavigation( |
1118 WebFrame*, const WebURLRequest&, WebNavigationType, | 1118 WebFrame*, const WebURLRequest&, WebNavigationType, |
1119 const WebNode& originatingNode, | 1119 const WebNode& originatingNode, |
1120 WebNavigationPolicy defaultPolicy, bool isRedirect) | 1120 WebNavigationPolicy defaultPolicy, bool isRedirect) |
1121 { | 1121 { |
1122 EXPECT_FALSE(isRedirect); | 1122 EXPECT_FALSE(isRedirect); |
1123 return WebNavigationPolicyCurrentTab; | 1123 return WebNavigationPolicyCurrentTab; |
1124 } | 1124 } |
1125 | |
1126 virtual WebURLError cancelledError(WebFrame*, const WebURLRequest& request) | |
1127 { | |
1128 // Return a dummy error so the DocumentLoader doesn't assert when | |
1129 // the reload cancels it. | |
1130 WebURLError webURLError; | |
1131 webURLError.domain = ""; | |
1132 webURLError.reason = 1; | |
1133 webURLError.isCancellation = true; | |
1134 webURLError.unreachableURL = WebURL(); | |
1135 return webURLError; | |
1136 } | |
1137 }; | 1125 }; |
1138 | 1126 |
1139 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) | 1127 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) |
1140 { | 1128 { |
1141 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 1129 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
1142 // would sometimes call decidePolicyForNavigation with isRedirect=true | 1130 // would sometimes call decidePolicyForNavigation with isRedirect=true |
1143 registerMockedHttpURLLoad("form.html"); | 1131 registerMockedHttpURLLoad("form.html"); |
1144 | 1132 |
1145 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 1133 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
1146 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); | 1134 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); |
(...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2685 EXPECT_FALSE(client.wasProgrammaticScroll()); | 2673 EXPECT_FALSE(client.wasProgrammaticScroll()); |
2686 EXPECT_TRUE(client.wasUserScroll()); | 2674 EXPECT_TRUE(client.wasUserScroll()); |
2687 client.reset(); | 2675 client.reset(); |
2688 | 2676 |
2689 m_webView->close(); | 2677 m_webView->close(); |
2690 m_webView = 0; | 2678 m_webView = 0; |
2691 } | 2679 } |
2692 | 2680 |
2693 | 2681 |
2694 } // namespace | 2682 } // namespace |
OLD | NEW |