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

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

Issue 1387743002: Fixed expando-loss.html test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cache ScriptState and use it to wrap m_defaultVertexArrayObject. Created 5 years, 2 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 #include "config.h" 5 #include "config.h"
6 #include "modules/canvas2d/CanvasRenderingContext2D.h" 6 #include "modules/canvas2d/CanvasRenderingContext2D.h"
7 7
8 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/html/HTMLCanvasElement.h" 10 #include "core/html/HTMLCanvasElement.h"
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 EXPECT_NE(nullptr, canvasElement().renderingContext()); 55 EXPECT_NE(nullptr, canvasElement().renderingContext());
56 EXPECT_TRUE(canvasElement().renderingContext()->is2d()); 56 EXPECT_TRUE(canvasElement().renderingContext()->is2d());
57 return static_cast<CanvasRenderingContext2D*>(canvasElement().renderingConte xt()); 57 return static_cast<CanvasRenderingContext2D*>(canvasElement().renderingConte xt());
58 } 58 }
59 59
60 void CanvasRenderingContext2DAPITest::createContext(OpacityMode opacityMode) 60 void CanvasRenderingContext2DAPITest::createContext(OpacityMode opacityMode)
61 { 61 {
62 String canvasType("2d"); 62 String canvasType("2d");
63 CanvasContextCreationAttributes attributes; 63 CanvasContextCreationAttributes attributes;
64 attributes.setAlpha(opacityMode == NonOpaque); 64 attributes.setAlpha(opacityMode == NonOpaque);
65 m_canvasElement->getCanvasRenderingContext(canvasType, attributes); 65 m_canvasElement->getCanvasRenderingContext(nullptr, canvasType, attributes);
haraken 2015/10/13 02:02:04 Ditto.
66 context2d(); // Calling this for the checks 66 context2d(); // Calling this for the checks
67 } 67 }
68 68
69 void CanvasRenderingContext2DAPITest::SetUp() 69 void CanvasRenderingContext2DAPITest::SetUp()
70 { 70 {
71 Page::PageClients pageClients; 71 Page::PageClients pageClients;
72 fillWithEmptyClients(pageClients); 72 fillWithEmptyClients(pageClients);
73 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients) ; 73 m_dummyPageHolder = DummyPageHolder::create(IntSize(800, 600), &pageClients) ;
74 m_document = toHTMLDocument(&m_dummyPageHolder->document()); 74 m_document = toHTMLDocument(&m_dummyPageHolder->document());
75 m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canvas>< /body>", ASSERT_NO_EXCEPTION); 75 m_document->documentElement()->setInnerHTML("<body><canvas id='c'></canvas>< /body>", ASSERT_NO_EXCEPTION);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 { 243 {
244 document.documentElement()->setInnerHTML( 244 document.documentElement()->setInnerHTML(
245 "<canvas id='canvas' style='position:absolute; top:0px; left:0px; paddin g:10px; margin:5px;'>" 245 "<canvas id='canvas' style='position:absolute; top:0px; left:0px; paddin g:10px; margin:5px;'>"
246 "<button id='button'></button></canvas>", ASSERT_NO_EXCEPTION); 246 "<button id='button'></button></canvas>", ASSERT_NO_EXCEPTION);
247 document.settings()->setAccessibilityEnabled(true); 247 document.settings()->setAccessibilityEnabled(true);
248 HTMLCanvasElement* canvas = toHTMLCanvasElement(document.getElementById("can vas")); 248 HTMLCanvasElement* canvas = toHTMLCanvasElement(document.getElementById("can vas"));
249 249
250 String canvasType("2d"); 250 String canvasType("2d");
251 CanvasContextCreationAttributes attributes; 251 CanvasContextCreationAttributes attributes;
252 attributes.setAlpha(true); 252 attributes.setAlpha(true);
253 canvas->getCanvasRenderingContext(canvasType, attributes); 253 canvas->getCanvasRenderingContext(nullptr, canvasType, attributes);
254 254
255 EXPECT_NE(nullptr, canvas->renderingContext()); 255 EXPECT_NE(nullptr, canvas->renderingContext());
256 EXPECT_TRUE(canvas->renderingContext()->is2d()); 256 EXPECT_TRUE(canvas->renderingContext()->is2d());
257 } 257 }
258 258
259 TEST_F(CanvasRenderingContext2DAPITest, AccessibilityRectTestForAddHitRegion) 259 TEST_F(CanvasRenderingContext2DAPITest, AccessibilityRectTestForAddHitRegion)
260 { 260 {
261 resetCanvasForAccessibilityRectTest(document()); 261 resetCanvasForAccessibilityRectTest(document());
262 262
263 Element* buttonElement = document().getElementById("button"); 263 Element* buttonElement = document().getElementById("button");
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 AXObjectCacheImpl* axObjectCache = toAXObjectCacheImpl(document().existingAX ObjectCache()); 298 AXObjectCacheImpl* axObjectCache = toAXObjectCacheImpl(document().existingAX ObjectCache());
299 AXObject* axObject = axObjectCache->getOrCreate(buttonElement); 299 AXObject* axObject = axObjectCache->getOrCreate(buttonElement);
300 300
301 EXPECT_EQ(25, axObject->elementRect().x().toInt()); 301 EXPECT_EQ(25, axObject->elementRect().x().toInt());
302 EXPECT_EQ(25, axObject->elementRect().y().toInt()); 302 EXPECT_EQ(25, axObject->elementRect().y().toInt());
303 EXPECT_EQ(40, axObject->elementRect().width().toInt()); 303 EXPECT_EQ(40, axObject->elementRect().width().toInt());
304 EXPECT_EQ(40, axObject->elementRect().height().toInt()); 304 EXPECT_EQ(40, axObject->elementRect().height().toInt());
305 } 305 }
306 306
307 } // namespace blink 307 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698