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

Side by Side Diff: third_party/WebKit/Source/modules/canvas2d/CanvasRenderingContext2DUsageTrackingTest.cpp

Issue 2796653003: Move ScriptState::forWorld/ScriptState::forMainWorld (Part 2) (Closed)
Patch Set: Rebase Created 3 years, 8 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 "modules/canvas2d/CanvasRenderingContext2D.h" 5 #include "modules/canvas2d/CanvasRenderingContext2D.h"
6 6
7 #include "bindings/core/v8/V8Binding.h"
7 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
8 #include "core/frame/FrameView.h" 9 #include "core/frame/FrameView.h"
9 #include "core/frame/Settings.h" 10 #include "core/frame/Settings.h"
10 #include "core/html/HTMLCanvasElement.h" 11 #include "core/html/HTMLCanvasElement.h"
11 #include "core/html/ImageData.h" 12 #include "core/html/ImageData.h"
12 #include "core/loader/EmptyClients.h" 13 #include "core/loader/EmptyClients.h"
13 #include "core/testing/DummyPageHolder.h" 14 #include "core/testing/DummyPageHolder.h"
14 #include "modules/accessibility/AXObject.h" 15 #include "modules/accessibility/AXObject.h"
15 #include "modules/accessibility/AXObjectCacheImpl.h" 16 #include "modules/accessibility/AXObjectCacheImpl.h"
16 #include "modules/canvas2d/CanvasGradient.h" 17 #include "modules/canvas2d/CanvasGradient.h"
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 CanvasRenderingContext2D* context2d() const; 93 CanvasRenderingContext2D* context2d() const;
93 94
94 void createContext(OpacityMode); 95 void createContext(OpacityMode);
95 96
96 FakeImageSource m_opaqueBitmap; 97 FakeImageSource m_opaqueBitmap;
97 FakeImageSource m_alphaBitmap; 98 FakeImageSource m_alphaBitmap;
98 Persistent<ImageData> m_fullImageData; 99 Persistent<ImageData> m_fullImageData;
99 void TearDown(); 100 void TearDown();
100 101
101 ScriptState* getScriptState() { 102 ScriptState* getScriptState() {
102 return ScriptState::forMainWorld(m_canvasElement->frame()); 103 return toScriptStateForMainWorld(m_canvasElement->frame());
103 } 104 }
104 105
105 private: 106 private:
106 std::shared_ptr<DummyPageHolder> m_dummyPageHolder; 107 std::shared_ptr<DummyPageHolder> m_dummyPageHolder;
107 Persistent<Document> m_document; 108 Persistent<Document> m_document;
108 Persistent<HTMLCanvasElement> m_canvasElement; 109 Persistent<HTMLCanvasElement> m_canvasElement;
109 Persistent<MemoryCache> m_globalMemoryCache; 110 Persistent<MemoryCache> m_globalMemoryCache;
110 }; 111 };
111 112
112 CanvasRenderingContextUsageTrackingTest:: 113 CanvasRenderingContextUsageTrackingTest::
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 for (int i = 0; i < numReps; i++) { 672 for (int i = 0; i < numReps; i++) {
672 context2d()->fillRect(10, 10, 100, 100); 673 context2d()->fillRect(10, 10, 100, 100);
673 } 674 }
674 EXPECT_EQ( 675 EXPECT_EQ(
675 numReps, 676 numReps,
676 context2d()->getUsage().numDrawCalls[BaseRenderingContext2D::FillRect]); 677 context2d()->getUsage().numDrawCalls[BaseRenderingContext2D::FillRect]);
677 } 678 }
678 679
679 } // namespace UsageTrackingTests 680 } // namespace UsageTrackingTests
680 } // namespace blink 681 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698