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

Side by Side Diff: content/browser/compositor/software_output_device_ozone_unittest.cc

Issue 145293007: ui: No more TestCompositor. Use NullDraw contexts in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testsnulldraw: Created 6 years, 10 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "cc/output/software_frame_data.h" 7 #include "cc/output/software_frame_data.h"
8 #include "content/browser/compositor/software_output_device_ozone.h" 8 #include "content/browser/compositor/software_output_device_ozone.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/skia/include/core/SkBitmapDevice.h" 10 #include "third_party/skia/include/core/SkBitmapDevice.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 }; 81 };
82 82
83 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() { 83 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() {
84 message_loop_.reset(new base::MessageLoopForUI); 84 message_loop_.reset(new base::MessageLoopForUI);
85 } 85 }
86 86
87 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { 87 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() {
88 } 88 }
89 89
90 void SoftwareOutputDeviceOzoneTest::SetUp() { 90 void SoftwareOutputDeviceOzoneTest::SetUp() {
91 ui::InitializeContextFactoryForTests(false); 91 bool enable_pixel_output = false;
92 ui::InitializeContextFactoryForTests(enable_pixel_output);
92 ui::Compositor::Initialize(); 93 ui::Compositor::Initialize();
93 94
94 surface_factory_.reset(new MockSurfaceFactoryOzone()); 95 surface_factory_.reset(new MockSurfaceFactoryOzone());
95 gfx::SurfaceFactoryOzone::SetInstance(surface_factory_.get()); 96 gfx::SurfaceFactoryOzone::SetInstance(surface_factory_.get());
96 97
97 const gfx::Size size(500, 400); 98 const gfx::Size size(500, 400);
98 compositor_.reset(new ui::Compositor( 99 compositor_.reset(new ui::Compositor(
99 gfx::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget())); 100 gfx::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget()));
100 compositor_->SetScaleAndSize(1.0f, size); 101 compositor_->SetScaleAndSize(1.0f, size);
101 102
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 // painted. 187 // painted.
187 for (int i = 0; i < area.height(); ++i) { 188 for (int i = 0; i < area.height(); ++i) {
188 for (int j = 0; j < area.width(); ++j) { 189 for (int j = 0; j < area.width(); ++j) {
189 if (j < damage.width() && i < damage.height()) 190 if (j < damage.width() && i < damage.height())
190 EXPECT_EQ(SK_ColorWHITE, bitmap.getColor(j, i)); 191 EXPECT_EQ(SK_ColorWHITE, bitmap.getColor(j, i));
191 else 192 else
192 EXPECT_EQ(SK_ColorBLACK, bitmap.getColor(j, i)); 193 EXPECT_EQ(SK_ColorBLACK, bitmap.getColor(j, i));
193 } 194 }
194 } 195 }
195 } 196 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698