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

Unified Diff: ui/compositor/layer_unittest.cc

Issue 21052007: aura: Clean up compositor initialization/destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanupcompositor: Created 7 years, 5 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/compositor/layer_unittest.cc
diff --git a/ui/compositor/layer_unittest.cc b/ui/compositor/layer_unittest.cc
index 79ef288469e68d724cd4f7a645d9ecd60fa53857..0845224a5cb9f2d5cb1048752721bbbede103b64 100644
--- a/ui/compositor/layer_unittest.cc
+++ b/ui/compositor/layer_unittest.cc
@@ -17,7 +17,6 @@
#include "cc/test/pixel_test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/compositor/compositor_observer.h"
-#include "ui/compositor/compositor_setup.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_sequence.h"
#include "ui/compositor/layer_animator.h"
@@ -82,13 +81,18 @@ class LayerWithRealCompositorTest : public testing::Test {
// Overridden from testing::Test:
virtual void SetUp() OVERRIDE {
- DisableTestCompositor();
+ bool allow_test_contexts = false;
+ Compositor::InitializeContextFactoryForTests(allow_test_contexts);
+ Compositor::Initialize();
+
const gfx::Rect host_bounds(10, 10, 500, 500);
window_.reset(TestCompositorHost::Create(host_bounds));
window_->Show();
}
virtual void TearDown() OVERRIDE {
+ window_.reset();
+ Compositor::Terminate();
}
Compositor* GetCompositor() {
@@ -310,21 +314,21 @@ class TestCompositorObserver : public CompositorObserver {
#if defined(OS_WIN)
// These are disabled on windows as they don't run correctly on the buildbot.
// Reenable once we move to the real compositor.
-#define MAYBE_Delegate DISABLED_Delegate
-#define MAYBE_Draw DISABLED_Draw
-#define MAYBE_DrawTree DISABLED_DrawTree
-#define MAYBE_Hierarchy DISABLED_Hierarchy
-#define MAYBE_HierarchyNoTexture DISABLED_HierarchyNoTexture
-#define MAYBE_DrawPixels DISABLED_DrawPixels
-#define MAYBE_SetRootLayer DISABLED_SetRootLayer
-#define MAYBE_CompositorObservers DISABLED_CompositorObservers
-#define MAYBE_ModifyHierarchy DISABLED_ModifyHierarchy
-#define MAYBE_Opacity DISABLED_Opacity
-#define MAYBE_ScaleUpDown DISABLED_ScaleUpDown
-#define MAYBE_ScaleReparent DISABLED_ScaleReparent
-#define MAYBE_NoScaleCanvas DISABLED_NoScaleCanvas
-#define MAYBE_AddRemoveThreadedAnimations DISABLED_AddRemoveThreadedAnimations
-#define MAYBE_SwitchCCLayerAnimations DISABLED_SwitchCCLayerAnimations
+#define MAYBE_Delegate Delegate
+#define MAYBE_Draw Draw
+#define MAYBE_DrawTree DrawTree
+#define MAYBE_Hierarchy Hierarchy
+#define MAYBE_HierarchyNoTexture HierarchyNoTexture
+#define MAYBE_DrawPixels DrawPixels
+#define MAYBE_SetRootLayer SetRootLayer
+#define MAYBE_CompositorObservers CompositorObservers
+#define MAYBE_ModifyHierarchy ModifyHierarchy
+#define MAYBE_Opacity Opacity
+#define MAYBE_ScaleUpDown ScaleUpDown
+#define MAYBE_ScaleReparent ScaleReparent
+#define MAYBE_NoScaleCanvas NoScaleCanvas
+#define MAYBE_AddRemoveThreadedAnimations AddRemoveThreadedAnimations
+#define MAYBE_SwitchCCLayerAnimations SwitchCCLayerAnimations
#else
#define MAYBE_Delegate Delegate
#define MAYBE_Draw Draw
@@ -379,12 +383,16 @@ class LayerWithDelegateTest : public testing::Test, public CompositorDelegate {
// Overridden from testing::Test:
virtual void SetUp() OVERRIDE {
- ui::SetupTestCompositor();
+ bool allow_test_contexts = true;
+ Compositor::InitializeContextFactoryForTests(allow_test_contexts);
+ Compositor::Initialize();
compositor_.reset(new Compositor(this, gfx::kNullAcceleratedWidget));
compositor_->SetScaleAndSize(1.0f, gfx::Size(1000, 1000));
}
virtual void TearDown() OVERRIDE {
+ compositor_.reset();
+ Compositor::Terminate();
}
Compositor* compositor() { return compositor_.get(); }
@@ -590,15 +598,11 @@ class LayerWithNullDelegateTest : public LayerWithDelegateTest {
LayerWithNullDelegateTest() {}
virtual ~LayerWithNullDelegateTest() {}
- // Overridden from testing::Test:
virtual void SetUp() OVERRIDE {
LayerWithDelegateTest::SetUp();
default_layer_delegate_.reset(new NullLayerDelegate());
}
- virtual void TearDown() OVERRIDE {
- }
-
virtual Layer* CreateLayer(LayerType type) OVERRIDE {
Layer* layer = new Layer(type);
layer->set_delegate(default_layer_delegate_.get());

Powered by Google App Engine
This is Rietveld 408576698