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

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

Issue 277713002: ui/compositor: move the browser compositor thread to the ContextFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, fix includes Created 6 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 | 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/SkSurface.h" 10 #include "third_party/skia/include/core/SkSurface.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest() 93 SoftwareOutputDeviceOzoneTest::SoftwareOutputDeviceOzoneTest()
94 : enable_pixel_output_(false) { 94 : enable_pixel_output_(false) {
95 message_loop_.reset(new base::MessageLoopForUI); 95 message_loop_.reset(new base::MessageLoopForUI);
96 } 96 }
97 97
98 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() { 98 SoftwareOutputDeviceOzoneTest::~SoftwareOutputDeviceOzoneTest() {
99 } 99 }
100 100
101 void SoftwareOutputDeviceOzoneTest::SetUp() { 101 void SoftwareOutputDeviceOzoneTest::SetUp() {
102 ui::InitializeContextFactoryForTests(enable_pixel_output_); 102 ui::InitializeContextFactoryForTests(enable_pixel_output_);
103 ui::Compositor::Initialize();
104 103
105 surface_factory_.reset(new MockSurfaceFactoryOzone()); 104 surface_factory_.reset(new MockSurfaceFactoryOzone());
106 gfx::SurfaceFactoryOzone::SetInstance(surface_factory_.get()); 105 gfx::SurfaceFactoryOzone::SetInstance(surface_factory_.get());
107 106
108 const gfx::Size size(500, 400); 107 const gfx::Size size(500, 400);
109 compositor_.reset(new ui::Compositor( 108 compositor_.reset(new ui::Compositor(
110 gfx::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget())); 109 gfx::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget()));
111 compositor_->SetScaleAndSize(1.0f, size); 110 compositor_->SetScaleAndSize(1.0f, size);
112 111
113 output_device_.reset(new content::SoftwareOutputDeviceOzone( 112 output_device_.reset(new content::SoftwareOutputDeviceOzone(
114 compositor_.get())); 113 compositor_.get()));
115 output_device_->Resize(size); 114 output_device_->Resize(size);
116 } 115 }
117 116
118 void SoftwareOutputDeviceOzoneTest::TearDown() { 117 void SoftwareOutputDeviceOzoneTest::TearDown() {
119 output_device_.reset(); 118 output_device_.reset();
120 compositor_.reset(); 119 compositor_.reset();
121 surface_factory_.reset(); 120 surface_factory_.reset();
122 ui::TerminateContextFactoryForTests(); 121 ui::TerminateContextFactoryForTests();
123 ui::Compositor::Terminate();
124 } 122 }
125 123
126 class SoftwareOutputDeviceOzonePixelTest 124 class SoftwareOutputDeviceOzonePixelTest
127 : public SoftwareOutputDeviceOzoneTest { 125 : public SoftwareOutputDeviceOzoneTest {
128 protected: 126 protected:
129 virtual void SetUp() OVERRIDE; 127 virtual void SetUp() OVERRIDE;
130 }; 128 };
131 129
132 void SoftwareOutputDeviceOzonePixelTest::SetUp() { 130 void SoftwareOutputDeviceOzonePixelTest::SetUp() {
133 enable_pixel_output_ = true; 131 enable_pixel_output_ = true;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK); 185 const SkPMColor black = SkPreMultiplyColor(SK_ColorBLACK);
188 for (int i = 0; i < area.height(); ++i) { 186 for (int i = 0; i < area.height(); ++i) {
189 for (int j = 0; j < area.width(); ++j) { 187 for (int j = 0; j < area.width(); ++j) {
190 if (j < damage.width() && i < damage.height()) 188 if (j < damage.width() && i < damage.height())
191 EXPECT_EQ(white, pixels[i * area.width() + j]); 189 EXPECT_EQ(white, pixels[i * area.width() + j]);
192 else 190 else
193 EXPECT_EQ(black, pixels[i * area.width() + j]); 191 EXPECT_EQ(black, pixels[i * area.width() + j]);
194 } 192 }
195 } 193 }
196 } 194 }
OLDNEW
« no previous file with comments | « content/browser/compositor/software_browser_compositor_output_surface_unittest.cc ('k') | mojo/aura/context_factory_mojo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698