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

Side by Side Diff: third_party/WebKit/Source/core/workers/MainThreadWorkletTest.cpp

Issue 2839123003: Worklet: Introduce "pending tasks struct" concept defined in the Worklet spec (Closed)
Patch Set: address review comments Created 3 years, 7 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "bindings/core/v8/V8BindingForCore.h" 5 #include "bindings/core/v8/V8BindingForCore.h"
6 #include "core/frame/UseCounter.h" 6 #include "core/frame/UseCounter.h"
7 #include "core/testing/DummyPageHolder.h" 7 #include "core/testing/DummyPageHolder.h"
8 #include "core/workers/MainThreadWorkletGlobalScope.h" 8 #include "core/workers/MainThreadWorkletGlobalScope.h"
9 #include "platform/weborigin/SecurityOrigin.h" 9 #include "platform/weborigin/SecurityOrigin.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace blink { 12 namespace blink {
13 13
14 namespace {
15
16 class WorkletObjectProxyForTest final
17 : public GarbageCollectedFinalized<WorkletObjectProxyForTest>,
18 public WorkletObjectProxy {
19 USING_GARBAGE_COLLECTED_MIXIN(WorkletObjectProxyForTest);
20
21 public:
22 void DidFetchAndInvokeScript(int32_t request_id, bool success) {}
23 };
24
25 } // namespace
26
27 class MainThreadWorkletTest : public ::testing::Test { 14 class MainThreadWorkletTest : public ::testing::Test {
28 public: 15 public:
29 void SetUp() override { 16 void SetUp() override {
30 KURL url(kParsedURLString, "https://example.com/"); 17 KURL url(kParsedURLString, "https://example.com/");
31 page_ = DummyPageHolder::Create(); 18 page_ = DummyPageHolder::Create();
32 security_origin_ = SecurityOrigin::Create(url); 19 security_origin_ = SecurityOrigin::Create(url);
33 global_scope_ = new MainThreadWorkletGlobalScope( 20 global_scope_ = new MainThreadWorkletGlobalScope(
34 &page_->GetFrame(), url, "fake user agent", security_origin_.Get(), 21 &page_->GetFrame(), url, "fake user agent", security_origin_.Get(),
35 ToIsolate(page_->GetFrame().GetDocument()), 22 ToIsolate(page_->GetFrame().GetDocument()));
36 new WorkletObjectProxyForTest);
37 } 23 }
38 24
39 void TearDown() override { global_scope_->TerminateWorkletGlobalScope(); } 25 void TearDown() override { global_scope_->TerminateWorkletGlobalScope(); }
40 26
41 protected: 27 protected:
42 RefPtr<SecurityOrigin> security_origin_; 28 RefPtr<SecurityOrigin> security_origin_;
43 std::unique_ptr<DummyPageHolder> page_; 29 std::unique_ptr<DummyPageHolder> page_;
44 Persistent<MainThreadWorkletGlobalScope> global_scope_; 30 Persistent<MainThreadWorkletGlobalScope> global_scope_;
45 }; 31 };
46 32
(...skipping 14 matching lines...) Expand all
61 UseCounter::Feature::kPrefixedStorageInfo; 47 UseCounter::Feature::kPrefixedStorageInfo;
62 48
63 // Deprecated API use on the MainThreadWorkletGlobalScope should be recorded 49 // Deprecated API use on the MainThreadWorkletGlobalScope should be recorded
64 // in UseCounter on the Document. 50 // in UseCounter on the Document.
65 EXPECT_FALSE(UseCounter::IsCounted(document, kFeature2)); 51 EXPECT_FALSE(UseCounter::IsCounted(document, kFeature2));
66 Deprecation::CountDeprecation(global_scope_, kFeature2); 52 Deprecation::CountDeprecation(global_scope_, kFeature2);
67 EXPECT_TRUE(UseCounter::IsCounted(document, kFeature2)); 53 EXPECT_TRUE(UseCounter::IsCounted(document, kFeature2));
68 } 54 }
69 55
70 } // namespace blink 56 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698