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

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

Issue 2858493002: Rename AXObject to AXObjectImpl in modules/ and web/ (Closed)
Patch Set: Fixed rebase 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 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 "modules/canvas2d/CanvasRenderingContext2D.h" 5 #include "modules/canvas2d/CanvasRenderingContext2D.h"
6 6
7 #include <memory>
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/AXObjectCacheImpl.h" 15 #include "modules/accessibility/AXObjectCacheImpl.h"
16 #include "modules/accessibility/AXObjectImpl.h"
16 #include "modules/canvas2d/CanvasGradient.h" 17 #include "modules/canvas2d/CanvasGradient.h"
17 #include "modules/canvas2d/CanvasPattern.h" 18 #include "modules/canvas2d/CanvasPattern.h"
18 #include "modules/canvas2d/HitRegionOptions.h" 19 #include "modules/canvas2d/HitRegionOptions.h"
19 #include "modules/webgl/WebGLRenderingContext.h" 20 #include "modules/webgl/WebGLRenderingContext.h"
20 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 21 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
21 #include "testing/gmock/include/gmock/gmock.h" 22 #include "testing/gmock/include/gmock/gmock.h"
22 #include "testing/gtest/include/gtest/gtest.h" 23 #include "testing/gtest/include/gtest/gtest.h"
23 #include <memory>
24 24
25 using ::testing::Mock; 25 using ::testing::Mock;
26 26
27 namespace blink { 27 namespace blink {
28 28
29 class CanvasRenderingContext2DAPITest : public ::testing::Test { 29 class CanvasRenderingContext2DAPITest : public ::testing::Test {
30 protected: 30 protected:
31 CanvasRenderingContext2DAPITest(); 31 CanvasRenderingContext2DAPITest();
32 void SetUp() override; 32 void SetUp() override;
33 33
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 NonThrowableExceptionState exception_state; 324 NonThrowableExceptionState exception_state;
325 HitRegionOptions options; 325 HitRegionOptions options;
326 options.setControl(button_element); 326 options.setControl(button_element);
327 327
328 context->beginPath(); 328 context->beginPath();
329 context->rect(10, 10, 40, 40); 329 context->rect(10, 10, 40, 40);
330 context->addHitRegion(options, exception_state); 330 context->addHitRegion(options, exception_state);
331 331
332 AXObjectCacheImpl* ax_object_cache = 332 AXObjectCacheImpl* ax_object_cache =
333 ToAXObjectCacheImpl(GetDocument().ExistingAXObjectCache()); 333 ToAXObjectCacheImpl(GetDocument().ExistingAXObjectCache());
334 AXObject* ax_object = ax_object_cache->GetOrCreate(button_element); 334 AXObjectImpl* ax_object = ax_object_cache->GetOrCreate(button_element);
335 335
336 LayoutRect ax_bounds = ax_object->GetBoundsInFrameCoordinates(); 336 LayoutRect ax_bounds = ax_object->GetBoundsInFrameCoordinates();
337 EXPECT_EQ(25, ax_bounds.X().ToInt()); 337 EXPECT_EQ(25, ax_bounds.X().ToInt());
338 EXPECT_EQ(25, ax_bounds.Y().ToInt()); 338 EXPECT_EQ(25, ax_bounds.Y().ToInt());
339 EXPECT_EQ(40, ax_bounds.Width().ToInt()); 339 EXPECT_EQ(40, ax_bounds.Width().ToInt());
340 EXPECT_EQ(40, ax_bounds.Height().ToInt()); 340 EXPECT_EQ(40, ax_bounds.Height().ToInt());
341 } 341 }
342 342
343 TEST_F(CanvasRenderingContext2DAPITest, 343 TEST_F(CanvasRenderingContext2DAPITest,
344 AccessibilityRectTestForDrawFocusIfNeeded) { 344 AccessibilityRectTestForDrawFocusIfNeeded) {
345 ResetCanvasForAccessibilityRectTest(GetDocument()); 345 ResetCanvasForAccessibilityRectTest(GetDocument());
346 346
347 Element* button_element = GetDocument().getElementById("button"); 347 Element* button_element = GetDocument().getElementById("button");
348 HTMLCanvasElement* canvas = 348 HTMLCanvasElement* canvas =
349 toHTMLCanvasElement(GetDocument().getElementById("canvas")); 349 toHTMLCanvasElement(GetDocument().getElementById("canvas"));
350 CanvasRenderingContext2D* context = 350 CanvasRenderingContext2D* context =
351 static_cast<CanvasRenderingContext2D*>(canvas->RenderingContext()); 351 static_cast<CanvasRenderingContext2D*>(canvas->RenderingContext());
352 352
353 GetDocument().UpdateStyleAndLayoutTreeForNode(canvas); 353 GetDocument().UpdateStyleAndLayoutTreeForNode(canvas);
354 354
355 context->beginPath(); 355 context->beginPath();
356 context->rect(10, 10, 40, 40); 356 context->rect(10, 10, 40, 40);
357 context->drawFocusIfNeeded(button_element); 357 context->drawFocusIfNeeded(button_element);
358 358
359 AXObjectCacheImpl* ax_object_cache = 359 AXObjectCacheImpl* ax_object_cache =
360 ToAXObjectCacheImpl(GetDocument().ExistingAXObjectCache()); 360 ToAXObjectCacheImpl(GetDocument().ExistingAXObjectCache());
361 AXObject* ax_object = ax_object_cache->GetOrCreate(button_element); 361 AXObjectImpl* ax_object = ax_object_cache->GetOrCreate(button_element);
362 362
363 LayoutRect ax_bounds = ax_object->GetBoundsInFrameCoordinates(); 363 LayoutRect ax_bounds = ax_object->GetBoundsInFrameCoordinates();
364 EXPECT_EQ(25, ax_bounds.X().ToInt()); 364 EXPECT_EQ(25, ax_bounds.X().ToInt());
365 EXPECT_EQ(25, ax_bounds.Y().ToInt()); 365 EXPECT_EQ(25, ax_bounds.Y().ToInt());
366 EXPECT_EQ(40, ax_bounds.Width().ToInt()); 366 EXPECT_EQ(40, ax_bounds.Width().ToInt());
367 EXPECT_EQ(40, ax_bounds.Height().ToInt()); 367 EXPECT_EQ(40, ax_bounds.Height().ToInt());
368 } 368 }
369 369
370 } // namespace blink 370 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698