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

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

Issue 2853743002: Worklet: Introduce PaintWorkletGlobalScopeProxy (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 class MainThreadWorkletTest : public ::testing::Test { 14 class MainThreadWorkletTest : public ::testing::Test {
15 public: 15 public:
16 void SetUp() override { 16 void SetUp() override {
17 KURL url(kParsedURLString, "https://example.com/"); 17 KURL url(kParsedURLString, "https://example.com/");
18 page_ = DummyPageHolder::Create(); 18 page_ = DummyPageHolder::Create();
19 security_origin_ = SecurityOrigin::Create(url); 19 security_origin_ = SecurityOrigin::Create(url);
20 global_scope_ = new MainThreadWorkletGlobalScope( 20 global_scope_ = new MainThreadWorkletGlobalScope(
21 &page_->GetFrame(), url, "fake user agent", security_origin_.Get(), 21 &page_->GetFrame(), url, "fake user agent", security_origin_.Get(),
22 ToIsolate(page_->GetFrame().GetDocument())); 22 ToIsolate(page_->GetFrame().GetDocument()));
23 } 23 }
24 24
25 void TearDown() override { global_scope_->TerminateWorkletGlobalScope(); } 25 void TearDown() override { global_scope_->Terminate(); }
26 26
27 protected: 27 protected:
28 RefPtr<SecurityOrigin> security_origin_; 28 RefPtr<SecurityOrigin> security_origin_;
29 std::unique_ptr<DummyPageHolder> page_; 29 std::unique_ptr<DummyPageHolder> page_;
30 Persistent<MainThreadWorkletGlobalScope> global_scope_; 30 Persistent<MainThreadWorkletGlobalScope> global_scope_;
31 }; 31 };
32 32
33 TEST_F(MainThreadWorkletTest, UseCounter) { 33 TEST_F(MainThreadWorkletTest, UseCounter) {
34 Document& document = *page_->GetFrame().GetDocument(); 34 Document& document = *page_->GetFrame().GetDocument();
35 35
(...skipping 11 matching lines...) Expand all
47 UseCounter::Feature::kPrefixedStorageInfo; 47 UseCounter::Feature::kPrefixedStorageInfo;
48 48
49 // Deprecated API use on the MainThreadWorkletGlobalScope should be recorded 49 // Deprecated API use on the MainThreadWorkletGlobalScope should be recorded
50 // in UseCounter on the Document. 50 // in UseCounter on the Document.
51 EXPECT_FALSE(UseCounter::IsCounted(document, kFeature2)); 51 EXPECT_FALSE(UseCounter::IsCounted(document, kFeature2));
52 Deprecation::CountDeprecation(global_scope_, kFeature2); 52 Deprecation::CountDeprecation(global_scope_, kFeature2);
53 EXPECT_TRUE(UseCounter::IsCounted(document, kFeature2)); 53 EXPECT_TRUE(UseCounter::IsCounted(document, kFeature2));
54 } 54 }
55 55
56 } // namespace blink 56 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698