Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: third_party/WebKit/Source/bindings/core/v8/ScriptStreamerTest.cpp

Issue 2080623002: Revert "Remove OwnPtr from Blink." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "bindings/core/v8/ScriptStreamer.h" 6 #include "bindings/core/v8/ScriptStreamer.h"
7 7
8 #include "bindings/core/v8/ScriptSourceCode.h" 8 #include "bindings/core/v8/ScriptSourceCode.h"
9 #include "bindings/core/v8/ScriptStreamerThread.h" 9 #include "bindings/core/v8/ScriptStreamerThread.h"
10 #include "bindings/core/v8/V8Binding.h" 10 #include "bindings/core/v8/V8Binding.h"
11 #include "bindings/core/v8/V8BindingForTesting.h" 11 #include "bindings/core/v8/V8BindingForTesting.h"
12 #include "bindings/core/v8/V8ScriptRunner.h" 12 #include "bindings/core/v8/V8ScriptRunner.h"
13 #include "core/dom/Element.h" 13 #include "core/dom/Element.h"
14 #include "core/dom/PendingScript.h" 14 #include "core/dom/PendingScript.h"
15 #include "core/frame/Settings.h" 15 #include "core/frame/Settings.h"
16 #include "platform/heap/Handle.h" 16 #include "platform/heap/Handle.h"
17 #include "platform/testing/UnitTestHelpers.h" 17 #include "platform/testing/UnitTestHelpers.h"
18 #include "public/platform/Platform.h" 18 #include "public/platform/Platform.h"
19 #include "public/platform/WebScheduler.h" 19 #include "public/platform/WebScheduler.h"
20 #include "testing/gtest/include/gtest/gtest.h" 20 #include "testing/gtest/include/gtest/gtest.h"
21 #include <memory>
22 #include <v8.h> 21 #include <v8.h>
23 22
24 namespace blink { 23 namespace blink {
25 24
26 namespace { 25 namespace {
27 26
28 class ScriptStreamingTest : public ::testing::Test { 27 class ScriptStreamingTest : public ::testing::Test {
29 public: 28 public:
30 ScriptStreamingTest() 29 ScriptStreamingTest()
31 : m_loadingTaskRunner(Platform::current()->currentThread()->scheduler()- >loadingTaskRunner()) 30 : m_loadingTaskRunner(Platform::current()->currentThread()->scheduler()- >loadingTaskRunner())
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 { 77 {
79 while (ScriptStreamerThread::shared()->isRunningTask()) { 78 while (ScriptStreamerThread::shared()->isRunningTask()) {
80 testing::runPendingTasks(); 79 testing::runPendingTasks();
81 } 80 }
82 // Once more, because the "streaming complete" notification might only 81 // Once more, because the "streaming complete" notification might only
83 // now be in the task queue. 82 // now be in the task queue.
84 testing::runPendingTasks(); 83 testing::runPendingTasks();
85 } 84 }
86 85
87 WebTaskRunner* m_loadingTaskRunner; // NOT OWNED 86 WebTaskRunner* m_loadingTaskRunner; // NOT OWNED
88 std::unique_ptr<Settings> m_settings; 87 OwnPtr<Settings> m_settings;
89 // The Resource and PendingScript where we stream from. These don't really 88 // The Resource and PendingScript where we stream from. These don't really
90 // fetch any data outside the test; the test controls the data by calling 89 // fetch any data outside the test; the test controls the data by calling
91 // ScriptResource::appendData. 90 // ScriptResource::appendData.
92 ResourceRequest m_resourceRequest; 91 ResourceRequest m_resourceRequest;
93 Persistent<ScriptResource> m_resource; 92 Persistent<ScriptResource> m_resource;
94 Persistent<PendingScript> m_pendingScript; 93 Persistent<PendingScript> m_pendingScript;
95 }; 94 };
96 95
97 class TestScriptResourceClient : public GarbageCollectedFinalized<TestScriptReso urceClient>, public ScriptResourceClient { 96 class TestScriptResourceClient : public GarbageCollectedFinalized<TestScriptReso urceClient>, public ScriptResourceClient {
98 USING_GARBAGE_COLLECTED_MIXIN(TestScriptResourceClient); 97 USING_GARBAGE_COLLECTED_MIXIN(TestScriptResourceClient);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 EXPECT_TRUE(sourceCode.streamer()); 386 EXPECT_TRUE(sourceCode.streamer());
388 v8::TryCatch tryCatch(scope.isolate()); 387 v8::TryCatch tryCatch(scope.isolate());
389 v8::Local<v8::Script> script; 388 v8::Local<v8::Script> script;
390 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, scope.isolate()).ToLoc al(&script)); 389 EXPECT_TRUE(V8ScriptRunner::compileScript(sourceCode, scope.isolate()).ToLoc al(&script));
391 EXPECT_FALSE(tryCatch.HasCaught()); 390 EXPECT_FALSE(tryCatch.HasCaught());
392 } 391 }
393 392
394 } // namespace 393 } // namespace
395 394
396 } // namespace blink 395 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698