| 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 1020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { | 1031 class TestReloadDoesntRedirectWebFrameClient : public WebFrameClient { |
| 1032 public: | 1032 public: |
| 1033 virtual WebNavigationPolicy decidePolicyForNavigation( | 1033 virtual WebNavigationPolicy decidePolicyForNavigation( |
| 1034 WebFrame*, const WebURLRequest&, WebNavigationType, | 1034 WebFrame*, const WebURLRequest&, WebNavigationType, |
| 1035 const WebNode& originatingNode, | 1035 const WebNode& originatingNode, |
| 1036 WebNavigationPolicy defaultPolicy, bool isRedirect) | 1036 WebNavigationPolicy defaultPolicy, bool isRedirect) |
| 1037 { | 1037 { |
| 1038 EXPECT_FALSE(isRedirect); | 1038 EXPECT_FALSE(isRedirect); |
| 1039 return WebNavigationPolicyCurrentTab; | 1039 return WebNavigationPolicyCurrentTab; |
| 1040 } | 1040 } |
| 1041 | |
| 1042 virtual WebURLError cancelledError(WebFrame*, const WebURLRequest& request) | |
| 1043 { | |
| 1044 // Return a dummy error so the DocumentLoader doesn't assert when | |
| 1045 // the reload cancels it. | |
| 1046 WebURLError webURLError; | |
| 1047 webURLError.domain = ""; | |
| 1048 webURLError.reason = 1; | |
| 1049 webURLError.isCancellation = true; | |
| 1050 webURLError.unreachableURL = WebURL(); | |
| 1051 return webURLError; | |
| 1052 } | |
| 1053 }; | 1041 }; |
| 1054 | 1042 |
| 1055 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) | 1043 TEST_F(WebFrameTest, ReloadDoesntSetRedirect) |
| 1056 { | 1044 { |
| 1057 // Test for case in http://crbug.com/73104. Reloading a frame very quickly | 1045 // Test for case in http://crbug.com/73104. Reloading a frame very quickly |
| 1058 // would sometimes call decidePolicyForNavigation with isRedirect=true | 1046 // would sometimes call decidePolicyForNavigation with isRedirect=true |
| 1059 registerMockedHttpURLLoad("form.html"); | 1047 registerMockedHttpURLLoad("form.html"); |
| 1060 | 1048 |
| 1061 TestReloadDoesntRedirectWebFrameClient webFrameClient; | 1049 TestReloadDoesntRedirectWebFrameClient webFrameClient; |
| 1062 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); | 1050 m_webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "form.html",
false, &webFrameClient); |
| (...skipping 1538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2601 EXPECT_FALSE(client.wasProgrammaticScroll()); | 2589 EXPECT_FALSE(client.wasProgrammaticScroll()); |
| 2602 EXPECT_TRUE(client.wasUserScroll()); | 2590 EXPECT_TRUE(client.wasUserScroll()); |
| 2603 client.reset(); | 2591 client.reset(); |
| 2604 | 2592 |
| 2605 m_webView->close(); | 2593 m_webView->close(); |
| 2606 m_webView = 0; | 2594 m_webView = 0; |
| 2607 } | 2595 } |
| 2608 | 2596 |
| 2609 | 2597 |
| 2610 } // namespace | 2598 } // namespace |
| OLD | NEW |