| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 | 5 |
| 6 #include "config.h" | 6 #include "config.h" |
| 7 #include "bindings/core/v8/ScriptStreamer.h" | 7 #include "bindings/core/v8/ScriptStreamer.h" |
| 8 | 8 |
| 9 #include "bindings/core/v8/ScriptSourceCode.h" | 9 #include "bindings/core/v8/ScriptSourceCode.h" |
| 10 #include "bindings/core/v8/ScriptStreamerThread.h" | 10 #include "bindings/core/v8/ScriptStreamerThread.h" |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 appendData("function foo() {"); | 212 appendData("function foo() {"); |
| 213 | 213 |
| 214 // In general, we cannot control what the background thread is doing | 214 // In general, we cannot control what the background thread is doing |
| 215 // (whether it's parsing or waiting for more data). In this test, we have | 215 // (whether it's parsing or waiting for more data). In this test, we have |
| 216 // given it so little data that it's surely waiting for more. | 216 // given it so little data that it's surely waiting for more. |
| 217 | 217 |
| 218 // Simulate cancelling the network load (e.g., because the user navigated | 218 // Simulate cancelling the network load (e.g., because the user navigated |
| 219 // away). | 219 // away). |
| 220 EXPECT_FALSE(client.finished()); | 220 EXPECT_FALSE(client.finished()); |
| 221 pendingScript().stopWatchingForLoad(&client); | 221 pendingScript().stopWatchingForLoad(&client); |
| 222 pendingScript().releaseElementAndClear(); |
| 222 m_pendingScript = PendingScriptWrapper::create(); // This will destroy m_res
ource. | 223 m_pendingScript = PendingScriptWrapper::create(); // This will destroy m_res
ource. |
| 223 m_resource = 0; | 224 m_resource = 0; |
| 224 | 225 |
| 225 // The V8 side will complete too. This should not crash. We don't receive | 226 // The V8 side will complete too. This should not crash. We don't receive |
| 226 // any results from the streaming and the client doesn't get notified. | 227 // any results from the streaming and the client doesn't get notified. |
| 227 processTasksUntilStreamingComplete(); | 228 processTasksUntilStreamingComplete(); |
| 228 EXPECT_FALSE(client.finished()); | 229 EXPECT_FALSE(client.finished()); |
| 229 } | 230 } |
| 230 | 231 |
| 231 TEST_F(ScriptStreamingTest, SuppressingStreaming) | 232 TEST_F(ScriptStreamingTest, SuppressingStreaming) |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 274 |
| 274 bool errorOccurred = false; | 275 bool errorOccurred = false; |
| 275 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre
d); | 276 ScriptSourceCode sourceCode = pendingScript().getSource(KURL(), errorOccurre
d); |
| 276 EXPECT_FALSE(errorOccurred); | 277 EXPECT_FALSE(errorOccurred); |
| 277 EXPECT_FALSE(sourceCode.streamer()); | 278 EXPECT_FALSE(sourceCode.streamer()); |
| 278 } | 279 } |
| 279 | 280 |
| 280 } // namespace | 281 } // namespace |
| 281 | 282 |
| 282 } // namespace blink | 283 } // namespace blink |
| OLD | NEW |