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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 // The ContextFactory must exist before any Compositors are created. | 98 // The ContextFactory must exist before any Compositors are created. |
99 // Snapshot test tests real drawing and readback, so needs pixel output. | 99 // Snapshot test tests real drawing and readback, so needs pixel output. |
100 bool enable_pixel_output = true; | 100 bool enable_pixel_output = true; |
101 ui::ContextFactory* context_factory = nullptr; | 101 ui::ContextFactory* context_factory = nullptr; |
102 ui::ContextFactoryPrivate* context_factory_private = nullptr; | 102 ui::ContextFactoryPrivate* context_factory_private = nullptr; |
103 | 103 |
104 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, | 104 ui::InitializeContextFactoryForTests(enable_pixel_output, &context_factory, |
105 &context_factory_private); | 105 &context_factory_private); |
106 | 106 |
107 helper_.reset( | 107 helper_.reset(new aura::test::AuraTestHelper()); |
108 new aura::test::AuraTestHelper(base::MessageLoopForUI::current())); | |
109 helper_->SetUp(context_factory, context_factory_private); | 108 helper_->SetUp(context_factory, context_factory_private); |
110 new ::wm::DefaultActivationClient(helper_->root_window()); | 109 new ::wm::DefaultActivationClient(helper_->root_window()); |
111 } | 110 } |
112 | 111 |
113 void TearDown() override { | 112 void TearDown() override { |
114 test_window_.reset(); | 113 test_window_.reset(); |
115 delegate_.reset(); | 114 delegate_.reset(); |
116 helper_->RunAllPendingInMessageLoop(); | 115 helper_->RunAllPendingInMessageLoop(); |
117 helper_->TearDown(); | 116 helper_->TearDown(); |
118 ui::TerminateContextFactoryForTests(); | 117 ui::TerminateContextFactoryForTests(); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 gfx::SizeF snapshot_size(test_bounds.size()); | 285 gfx::SizeF snapshot_size(test_bounds.size()); |
287 snapshot_size.Scale(2.0f / kUIScale); | 286 snapshot_size.Scale(2.0f / kUIScale); |
288 | 287 |
289 gfx::Image snapshot = GrabSnapshotForTestWindow(); | 288 gfx::Image snapshot = GrabSnapshotForTestWindow(); |
290 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), | 289 EXPECT_EQ(gfx::ToRoundedSize(snapshot_size).ToString(), |
291 snapshot.Size().ToString()); | 290 snapshot.Size().ToString()); |
292 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2 / kUIScale)); | 291 EXPECT_EQ(0u, GetFailedPixelsCountWithScaleFactor(snapshot, 2 / kUIScale)); |
293 } | 292 } |
294 | 293 |
295 } // namespace ui | 294 } // namespace ui |
OLD | NEW |