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

Side by Side Diff: Source/core/html/canvas/CanvasRenderingContext2DTest.cpp

Issue 1171323003: Fix unit test style in core/{dom,editing,html}/. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: whitespace fix Created 5 years, 6 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 | Annotate | Revision Log
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
7 #include "core/html/canvas/CanvasRenderingContext2D.h" 6 #include "core/html/canvas/CanvasRenderingContext2D.h"
8 7
9 #include "core/frame/FrameView.h" 8 #include "core/frame/FrameView.h"
10 #include "core/frame/ImageBitmap.h" 9 #include "core/frame/ImageBitmap.h"
11 #include "core/html/HTMLDocument.h" 10 #include "core/html/HTMLDocument.h"
12 #include "core/html/ImageData.h" 11 #include "core/html/ImageData.h"
13 #include "core/html/canvas/CanvasGradient.h" 12 #include "core/html/canvas/CanvasGradient.h"
14 #include "core/html/canvas/CanvasPattern.h" 13 #include "core/html/canvas/CanvasPattern.h"
15 #include "core/html/canvas/WebGLRenderingContext.h" 14 #include "core/html/canvas/WebGLRenderingContext.h"
16 #include "core/loader/EmptyClients.h" 15 #include "core/loader/EmptyClients.h"
17 #include "core/testing/DummyPageHolder.h" 16 #include "core/testing/DummyPageHolder.h"
18 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h" 17 #include "platform/graphics/ExpensiveCanvasHeuristicParameters.h"
19 #include "platform/graphics/RecordingImageBufferSurface.h" 18 #include "platform/graphics/RecordingImageBufferSurface.h"
20 #include "platform/graphics/StaticBitmapImage.h" 19 #include "platform/graphics/StaticBitmapImage.h"
21 #include "platform/graphics/UnacceleratedImageBufferSurface.h" 20 #include "platform/graphics/UnacceleratedImageBufferSurface.h"
22 #include "third_party/skia/include/core/SkSurface.h" 21 #include "third_party/skia/include/core/SkSurface.h"
23 #include <gmock/gmock.h> 22 #include <gmock/gmock.h>
24 #include <gtest/gtest.h> 23 #include <gtest/gtest.h>
25 24
26 using namespace blink;
27 using ::testing::Mock; 25 using ::testing::Mock;
28 26
29 namespace { 27 namespace blink {
30 28
31 enum BitmapOpacity { 29 enum BitmapOpacity {
32 OpaqueBitmap, 30 OpaqueBitmap,
33 TransparentBitmap 31 TransparentBitmap
34 }; 32 };
35 33
36 class FakeImageSource : public CanvasImageSource { 34 class FakeImageSource : public CanvasImageSource {
37 public: 35 public:
38 FakeImageSource(IntSize, BitmapOpacity); 36 FakeImageSource(IntSize, BitmapOpacity);
39 37
(...skipping 26 matching lines...) Expand all
66 if (status) 64 if (status)
67 *status = NormalSourceImageStatus; 65 *status = NormalSourceImageStatus;
68 return m_image; 66 return m_image;
69 } 67 }
70 68
71 //============================================================================ 69 //============================================================================
72 70
73 class CanvasRenderingContext2DTest : public ::testing::Test { 71 class CanvasRenderingContext2DTest : public ::testing::Test {
74 protected: 72 protected:
75 CanvasRenderingContext2DTest(); 73 CanvasRenderingContext2DTest();
76 virtual void SetUp() override; 74 void SetUp() override;
77 75
78 DummyPageHolder& page() const { return *m_dummyPageHolder; } 76 DummyPageHolder& page() const { return *m_dummyPageHolder; }
79 HTMLDocument& document() const { return *m_document; } 77 HTMLDocument& document() const { return *m_document; }
80 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; } 78 HTMLCanvasElement& canvasElement() const { return *m_canvasElement; }
81 CanvasRenderingContext2D* context2d() const { return static_cast<CanvasRende ringContext2D*>(canvasElement().renderingContext()); } 79 CanvasRenderingContext2D* context2d() const { return static_cast<CanvasRende ringContext2D*>(canvasElement().renderingContext()); }
82 80
83 void createContext(OpacityMode); 81 void createContext(OpacityMode);
84 82
85 private: 83 private:
86 OwnPtr<DummyPageHolder> m_dummyPageHolder; 84 OwnPtr<DummyPageHolder> m_dummyPageHolder;
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 595
598 // The canvasChanged notification must be immediate, and not deferred until paint time 596 // The canvasChanged notification must be immediate, and not deferred until paint time
599 // because offscreen canvases, which are not painted, also need to emit noti fications. 597 // because offscreen canvases, which are not painted, also need to emit noti fications.
600 EXPECT_CALL(*observer, canvasChanged(&canvasElement(), FloatRect(0, 0, 1, 1) )).Times(1); 598 EXPECT_CALL(*observer, canvasChanged(&canvasElement(), FloatRect(0, 0, 1, 1) )).Times(1);
601 context2d()->fillRect(0, 0, 1, 1); 599 context2d()->fillRect(0, 0, 1, 1);
602 Mock::VerifyAndClearExpectations(observer.get()); 600 Mock::VerifyAndClearExpectations(observer.get());
603 601
604 canvasElement().removeObserver(observer.get()); 602 canvasElement().removeObserver(observer.get());
605 } 603 }
606 604
607 } // unnamed namespace 605 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2DAPITest.cpp ('k') | Source/core/html/forms/FileInputTypeTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698