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

Unified Diff: ui/snapshot/snapshot_aura_unittest.cc

Issue 145293007: ui: No more TestCompositor. Use NullDraw contexts in unit tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: testsnulldraw: Created 6 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ui/snapshot/snapshot_aura_unittest.cc
diff --git a/ui/snapshot/snapshot_aura_unittest.cc b/ui/snapshot/snapshot_aura_unittest.cc
index e01caf8f9dc710672bdcc75b8aee19dc677664fc..00b502973fda48e677fda016d89bb742dc2ed5af 100644
--- a/ui/snapshot/snapshot_aura_unittest.cc
+++ b/ui/snapshot/snapshot_aura_unittest.cc
@@ -14,6 +14,7 @@
#include "ui/aura/test/test_windows.h"
#include "ui/aura/window.h"
#include "ui/compositor/layer.h"
+#include "ui/compositor/test/context_factories_for_test.h"
#include "ui/compositor/test/draw_waiter_for_test.h"
#include "ui/gfx/canvas.h"
#include "ui/gfx/gfx_paths.h"
@@ -83,11 +84,15 @@ class SnapshotAuraTest : public testing::Test {
virtual void SetUp() OVERRIDE {
testing::Test::SetUp();
+
+ // The ContextFactory must exist before any Compositors are created.
+ // Snapshot test tests real drawing and readback, so needs pixel output.
+ bool enable_pixel_output = true;
+ ui::InitializeContextFactoryForTests(enable_pixel_output);
+
helper_.reset(
new aura::test::AuraTestHelper(base::MessageLoopForUI::current()));
- // Snapshot test tests real drawing and readback, so needs a real context.
- bool allow_test_contexts = false;
- helper_->SetUp(allow_test_contexts);
+ helper_->SetUp();
}
virtual void TearDown() OVERRIDE {
@@ -95,6 +100,7 @@ class SnapshotAuraTest : public testing::Test {
delegate_.reset();
helper_->RunAllPendingInMessageLoop();
helper_->TearDown();
+ ui::TerminateContextFactoryForTests();
testing::Test::TearDown();
}

Powered by Google App Engine
This is Rietveld 408576698