summaryrefslogtreecommitdiffstats
path: root/ui/gfx
diff options
context:
space:
mode:
authordhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-19 03:57:21 +0000
committerdhollowa@chromium.org <dhollowa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-19 03:57:21 +0000
commit1946e0c4351fbdfd5b012d3c2aeac2c9218ad027 (patch)
treea623b99b68bd278b0664a07180d0e2820eaae341 /ui/gfx
parent774bdcce34a2b1621b9959d9a569324058539d0a (diff)
downloadchromium_src-1946e0c4351fbdfd5b012d3c2aeac2c9218ad027.zip
chromium_src-1946e0c4351fbdfd5b012d3c2aeac2c9218ad027.tar.gz
chromium_src-1946e0c4351fbdfd5b012d3c2aeac2c9218ad027.tar.bz2
Mac/Aura compositor_unittests are failing
The problem was that the ui::Compositor keeps a "delegate" reference to the TestCompositorHostMac, but that gets deleted prior to the ref-counted ui::Compositor. The ui::Compositor reference is being held by the AcceleratedTestView which de-ref's the compositor too late in the game, namely when the Mac autorelease pools get drained. This is resolved here by explicitly clearing the reference that the view holds to the compositor. BUG=110666 TEST=LayerWithRealCompositorTest.* R=piman@chromium.org Review URL: https://chromiumcodereview.appspot.com/9253025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118235 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx')
-rw-r--r--ui/gfx/compositor/layer_animator_unittest.cc3
-rw-r--r--ui/gfx/compositor/test/test_compositor_host_mac.mm8
2 files changed, 7 insertions, 4 deletions
diff --git a/ui/gfx/compositor/layer_animator_unittest.cc b/ui/gfx/compositor/layer_animator_unittest.cc
index e7640fc..6488e56 100644
--- a/ui/gfx/compositor/layer_animator_unittest.cc
+++ b/ui/gfx/compositor/layer_animator_unittest.cc
@@ -65,7 +65,6 @@ TEST(LayerAnimatorTest, NoImplicitAnimation) {
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
- base::TimeTicks now = base::TimeTicks::Now();
animator->SetOpacity(0.5);
EXPECT_FALSE(animator->is_animating());
EXPECT_FLOAT_EQ(delegate.GetOpacityForAnimation(), 0.5);
@@ -78,7 +77,6 @@ TEST(LayerAnimatorTest, StopAnimatingProperty) {
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
- base::TimeTicks now = base::TimeTicks::Now();
double target_opacity(0.5);
gfx::Rect target_bounds(0, 0, 50, 50);
animator->SetOpacity(target_opacity);
@@ -98,7 +96,6 @@ TEST(LayerAnimatorTest, StopAnimating) {
animator->set_disable_timer_for_test(true);
TestLayerAnimationDelegate delegate;
animator->SetDelegate(&delegate);
- base::TimeTicks now = base::TimeTicks::Now();
double target_opacity(0.5);
gfx::Rect target_bounds(0, 0, 50, 50);
animator->SetOpacity(target_opacity);
diff --git a/ui/gfx/compositor/test/test_compositor_host_mac.mm b/ui/gfx/compositor/test/test_compositor_host_mac.mm
index 4cd1ee2..6b905f9 100644
--- a/ui/gfx/compositor/test/test_compositor_host_mac.mm
+++ b/ui/gfx/compositor/test/test_compositor_host_mac.mm
@@ -11,6 +11,7 @@
#import <Foundation/NSAutoreleasePool.h>
#include "base/compiler_specific.h"
+#include "base/memory/scoped_nsobject.h"
#include "ui/gfx/compositor/compositor.h"
#include "ui/gfx/rect.h"
@@ -105,6 +106,11 @@ TestCompositorHostMac::TestCompositorHostMac(const gfx::Rect& bounds)
}
TestCompositorHostMac::~TestCompositorHostMac() {
+ // Release reference to |compositor_|. Important because the |compositor_|
+ // holds |this| as its delegate, so that reference must be removed here.
+ [[window_ contentView] setCompositor:NULL];
+ [window_ setContentView:nil];
+
[window_ orderOut:nil];
[window_ close];
}
@@ -119,7 +125,7 @@ void TestCompositorHostMac::Show() {
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
- AcceleratedTestView* view = [[[AcceleratedTestView alloc] init] autorelease];
+ scoped_nsobject<AcceleratedTestView> view([[AcceleratedTestView alloc] init]);
compositor_ = ui::Compositor::Create(this, view, bounds_.size());
[view setCompositor:compositor_];
[window_ setContentView:view];