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

Side by Side Diff: ui/compositor/layer_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
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/test/in_process_context_factory.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } else { 84 } else {
85 LOG(ERROR) << "Could not open test data directory."; 85 LOG(ERROR) << "Could not open test data directory.";
86 } 86 }
87 } 87 }
88 virtual ~LayerWithRealCompositorTest() {} 88 virtual ~LayerWithRealCompositorTest() {}
89 89
90 // Overridden from testing::Test: 90 // Overridden from testing::Test:
91 virtual void SetUp() OVERRIDE { 91 virtual void SetUp() OVERRIDE {
92 bool enable_pixel_output = true; 92 bool enable_pixel_output = true;
93 InitializeContextFactoryForTests(enable_pixel_output); 93 InitializeContextFactoryForTests(enable_pixel_output);
94 Compositor::Initialize();
95 94
96 const gfx::Rect host_bounds(10, 10, 500, 500); 95 const gfx::Rect host_bounds(10, 10, 500, 500);
97 compositor_host_.reset(TestCompositorHost::Create(host_bounds)); 96 compositor_host_.reset(TestCompositorHost::Create(host_bounds));
98 compositor_host_->Show(); 97 compositor_host_->Show();
99 } 98 }
100 99
101 virtual void TearDown() OVERRIDE { 100 virtual void TearDown() OVERRIDE {
102 compositor_host_.reset(); 101 compositor_host_.reset();
103 TerminateContextFactoryForTests(); 102 TerminateContextFactoryForTests();
104 Compositor::Terminate();
105 } 103 }
106 104
107 Compositor* GetCompositor() { return compositor_host_->GetCompositor(); } 105 Compositor* GetCompositor() { return compositor_host_->GetCompositor(); }
108 106
109 Layer* CreateLayer(LayerType type) { 107 Layer* CreateLayer(LayerType type) {
110 return new Layer(type); 108 return new Layer(type);
111 } 109 }
112 110
113 Layer* CreateColorLayer(SkColor color, const gfx::Rect& bounds) { 111 Layer* CreateColorLayer(SkColor color, const gfx::Rect& bounds) {
114 Layer* layer = new ColoredLayer(color); 112 Layer* layer = new ColoredLayer(color);
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 391
394 class LayerWithDelegateTest : public testing::Test { 392 class LayerWithDelegateTest : public testing::Test {
395 public: 393 public:
396 LayerWithDelegateTest() {} 394 LayerWithDelegateTest() {}
397 virtual ~LayerWithDelegateTest() {} 395 virtual ~LayerWithDelegateTest() {}
398 396
399 // Overridden from testing::Test: 397 // Overridden from testing::Test:
400 virtual void SetUp() OVERRIDE { 398 virtual void SetUp() OVERRIDE {
401 bool enable_pixel_output = false; 399 bool enable_pixel_output = false;
402 InitializeContextFactoryForTests(enable_pixel_output); 400 InitializeContextFactoryForTests(enable_pixel_output);
403 Compositor::Initialize();
404 401
405 const gfx::Rect host_bounds(1000, 1000); 402 const gfx::Rect host_bounds(1000, 1000);
406 compositor_host_.reset(TestCompositorHost::Create(host_bounds)); 403 compositor_host_.reset(TestCompositorHost::Create(host_bounds));
407 compositor_host_->Show(); 404 compositor_host_->Show();
408 } 405 }
409 406
410 virtual void TearDown() OVERRIDE { 407 virtual void TearDown() OVERRIDE {
411 compositor_host_.reset(); 408 compositor_host_.reset();
412 TerminateContextFactoryForTests(); 409 TerminateContextFactoryForTests();
413 Compositor::Terminate();
414 } 410 }
415 411
416 Compositor* compositor() { return compositor_host_->GetCompositor(); } 412 Compositor* compositor() { return compositor_host_->GetCompositor(); }
417 413
418 virtual Layer* CreateLayer(LayerType type) { 414 virtual Layer* CreateLayer(LayerType type) {
419 return new Layer(type); 415 return new Layer(type);
420 } 416 }
421 417
422 Layer* CreateColorLayer(SkColor color, const gfx::Rect& bounds) { 418 Layer* CreateColorLayer(SkColor color, const gfx::Rect& bounds) {
423 Layer* layer = new ColoredLayer(color); 419 Layer* layer = new ColoredLayer(color);
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1524 l1->SetOpacity(0.5f); 1520 l1->SetOpacity(0.5f);
1525 1521
1526 // Change l1's cc::Layer. 1522 // Change l1's cc::Layer.
1527 l1->SwitchCCLayerForTest(); 1523 l1->SwitchCCLayerForTest();
1528 1524
1529 // Ensure that the opacity animation completed. 1525 // Ensure that the opacity animation completed.
1530 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f); 1526 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f);
1531 } 1527 }
1532 1528
1533 } // namespace ui 1529 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/compositor.cc ('k') | ui/compositor/test/in_process_context_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698