OLD | NEW |
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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 test_data_directory_ = test_data_directory_.AppendASCII("compositor"); | 83 test_data_directory_ = test_data_directory_.AppendASCII("compositor"); |
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 ui::ContextFactory* context_factory = |
| 94 InitializeContextFactoryForTests(enable_pixel_output); |
94 | 95 |
95 const gfx::Rect host_bounds(10, 10, 500, 500); | 96 const gfx::Rect host_bounds(10, 10, 500, 500); |
96 compositor_host_.reset(TestCompositorHost::Create(host_bounds)); | 97 compositor_host_.reset(TestCompositorHost::Create( |
| 98 host_bounds, context_factory)); |
97 compositor_host_->Show(); | 99 compositor_host_->Show(); |
98 } | 100 } |
99 | 101 |
100 virtual void TearDown() OVERRIDE { | 102 virtual void TearDown() OVERRIDE { |
101 compositor_host_.reset(); | 103 compositor_host_.reset(); |
102 TerminateContextFactoryForTests(); | 104 TerminateContextFactoryForTests(); |
103 } | 105 } |
104 | 106 |
105 Compositor* GetCompositor() { return compositor_host_->GetCompositor(); } | 107 Compositor* GetCompositor() { return compositor_host_->GetCompositor(); } |
106 | 108 |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 } | 392 } |
391 | 393 |
392 class LayerWithDelegateTest : public testing::Test { | 394 class LayerWithDelegateTest : public testing::Test { |
393 public: | 395 public: |
394 LayerWithDelegateTest() {} | 396 LayerWithDelegateTest() {} |
395 virtual ~LayerWithDelegateTest() {} | 397 virtual ~LayerWithDelegateTest() {} |
396 | 398 |
397 // Overridden from testing::Test: | 399 // Overridden from testing::Test: |
398 virtual void SetUp() OVERRIDE { | 400 virtual void SetUp() OVERRIDE { |
399 bool enable_pixel_output = false; | 401 bool enable_pixel_output = false; |
400 InitializeContextFactoryForTests(enable_pixel_output); | 402 ui::ContextFactory* context_factory = |
| 403 InitializeContextFactoryForTests(enable_pixel_output); |
401 | 404 |
402 const gfx::Rect host_bounds(1000, 1000); | 405 const gfx::Rect host_bounds(1000, 1000); |
403 compositor_host_.reset(TestCompositorHost::Create(host_bounds)); | 406 compositor_host_.reset(TestCompositorHost::Create(host_bounds, |
| 407 context_factory)); |
404 compositor_host_->Show(); | 408 compositor_host_->Show(); |
405 } | 409 } |
406 | 410 |
407 virtual void TearDown() OVERRIDE { | 411 virtual void TearDown() OVERRIDE { |
408 compositor_host_.reset(); | 412 compositor_host_.reset(); |
409 TerminateContextFactoryForTests(); | 413 TerminateContextFactoryForTests(); |
410 } | 414 } |
411 | 415 |
412 Compositor* compositor() { return compositor_host_->GetCompositor(); } | 416 Compositor* compositor() { return compositor_host_->GetCompositor(); } |
413 | 417 |
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 l1->SetOpacity(0.5f); | 1501 l1->SetOpacity(0.5f); |
1498 | 1502 |
1499 // Change l1's cc::Layer. | 1503 // Change l1's cc::Layer. |
1500 l1->SwitchCCLayerForTest(); | 1504 l1->SwitchCCLayerForTest(); |
1501 | 1505 |
1502 // Ensure that the opacity animation completed. | 1506 // Ensure that the opacity animation completed. |
1503 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f); | 1507 EXPECT_FLOAT_EQ(l1->opacity(), 0.5f); |
1504 } | 1508 } |
1505 | 1509 |
1506 } // namespace ui | 1510 } // namespace ui |
OLD | NEW |