OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ui/snapshot/snapshot.h" | 5 #include "ui/snapshot/snapshot.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 public: | 90 public: |
91 SnapshotAuraTest() {} | 91 SnapshotAuraTest() {} |
92 ~SnapshotAuraTest() override {} | 92 ~SnapshotAuraTest() override {} |
93 | 93 |
94 void SetUp() override { | 94 void SetUp() override { |
95 testing::Test::SetUp(); | 95 testing::Test::SetUp(); |
96 | 96 |
97 // The ContextFactory must exist before any Compositors are created. | 97 // The ContextFactory must exist before any Compositors are created. |
98 // Snapshot test tests real drawing and readback, so needs pixel output. | 98 // Snapshot test tests real drawing and readback, so needs pixel output. |
99 bool enable_pixel_output = true; | 99 bool enable_pixel_output = true; |
100 ui::ContextFactory* context_factory = | 100 ui::ContextFactory* context_factory = nullptr; |
101 ui::InitializeContextFactoryForTests(enable_pixel_output); | 101 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
| 102 |
| 103 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, |
| 104 &context_factory_private); |
102 | 105 |
103 helper_.reset( | 106 helper_.reset( |
104 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | 107 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); |
105 helper_->SetUp(context_factory); | 108 helper_->SetUp(context_factory, context_factory_private); |
106 new ::wm::DefaultActivationClient(helper_->root_window()); | 109 new ::wm::DefaultActivationClient(helper_->root_window()); |
107 } | 110 } |
108 | 111 |
109 void TearDown() override { | 112 void TearDown() override { |
110 test_window_.reset(); | 113 test_window_.reset(); |
111 delegate_.reset(); | 114 delegate_.reset(); |
112 helper_->RunAllPendingInMessageLoop(); | 115 helper_->RunAllPendingInMessageLoop(); |
113 helper_->TearDown(); | 116 helper_->TearDown(); |
114 ui::TerminateContextFactoryForTests(); | 117 ui::TerminateContextFactoryForTests(); |
115 testing::Test::TearDown(); | 118 testing::Test::TearDown(); |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 gfx::SizeF snapshot_size(test_bounds.size()); | 295 gfx::SizeF snapshot_size(test_bounds.size()); |
293 snapshot_size.Scale(2.0f); | 296 snapshot_size.Scale(2.0f); |
294 | 297 |
295 gfx::Image snapshot = GrabSnapshotForTestWindow(); | 298 gfx::Image snapshot = GrabSnapshotForTestWindow(); |
296 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), | 299 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), |
297 snapshot.Size().ToString()); | 300 snapshot.Size().ToString()); |
298 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2)); | 301 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2)); |
299 } | 302 } |
300 | 303 |
301 } // namespace ui | 304 } // namespace ui |
OLD | NEW |