| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/testing/URLTestHelpers.h" | 5 #include "platform/testing/URLTestHelpers.h" |
| 6 #include "public/platform/Platform.h" | 6 #include "public/platform/Platform.h" |
| 7 #include "public/platform/WebURLLoaderClient.h" | 7 #include "public/platform/WebURLLoaderClient.h" |
| 8 #include "public/platform/WebURLLoaderMockFactory.h" | 8 #include "public/platform/WebURLLoaderMockFactory.h" |
| 9 #include "public/web/WebCache.h" | 9 #include "public/web/WebCache.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 TemporaryChange<bool> dispatching(m_dispatchingDidReceiveData, t
rue); | 111 TemporaryChange<bool> dispatching(m_dispatchingDidReceiveData, t
rue); |
| 112 dispatchOneByte(); | 112 dispatchOneByte(); |
| 113 } | 113 } |
| 114 // Serve the remaining bytes to complete the load. | 114 // Serve the remaining bytes to complete the load. |
| 115 EXPECT_FALSE(m_data.empty()); | 115 EXPECT_FALSE(m_data.empty()); |
| 116 while (!m_data.empty()) | 116 while (!m_data.empty()) |
| 117 dispatchOneByte(); | 117 dispatchOneByte(); |
| 118 } | 118 } |
| 119 | 119 |
| 120 // WebFrameClient overrides: | 120 // WebFrameClient overrides: |
| 121 void frameDetached(WebFrame* frame, DetachType detachType) override | 121 void frameDetached(WebLocalFrame* frame, DetachType detachType) override |
| 122 { | 122 { |
| 123 if (m_dispatchingDidReceiveData) { | 123 if (m_dispatchingDidReceiveData) { |
| 124 // This should be called by the first didReceiveData() call, sin
ce | 124 // This should be called by the first didReceiveData() call, sin
ce |
| 125 // it should commit the provisional load. | 125 // it should commit the provisional load. |
| 126 EXPECT_GT(m_data.size(), 10u); | 126 EXPECT_GT(m_data.size(), 10u); |
| 127 // Dispatch dataReceived() callbacks for part of the remaining | 127 // Dispatch dataReceived() callbacks for part of the remaining |
| 128 // data, saving the rest to be dispatched at the top-level as | 128 // data, saving the rest to be dispatched at the top-level as |
| 129 // normal. | 129 // normal. |
| 130 while (m_data.size() > 10) | 130 while (m_data.size() > 10) |
| 131 dispatchOneByte(); | 131 dispatchOneByte(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 161 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); | 161 Platform::current()->getURLLoaderMockFactory()->setLoaderDelegate(nullptr); |
| 162 | 162 |
| 163 EXPECT_TRUE(delegate.servedReentrantly()); | 163 EXPECT_TRUE(delegate.servedReentrantly()); |
| 164 | 164 |
| 165 // delegate is a WebFrameClient and stack-allocated, so manually reset() the | 165 // delegate is a WebFrameClient and stack-allocated, so manually reset() the |
| 166 // WebViewHelper here. | 166 // WebViewHelper here. |
| 167 m_webViewHelper.reset(); | 167 m_webViewHelper.reset(); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace blink | 170 } // namespace blink |
| OLD | NEW |