summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorsky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 19:27:24 +0000
committersky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-04-07 19:27:24 +0000
commit8bd8aa1f07df8752a74e79bbcfb6d49e8a49d517 (patch)
tree0e1be35cc0e0caea9d20d064f95a7a426fc8fa04 /app
parent4f9cd41c22af611e92609757fdcb3a5de01c3752 (diff)
downloadchromium_src-8bd8aa1f07df8752a74e79bbcfb6d49e8a49d517.zip
chromium_src-8bd8aa1f07df8752a74e79bbcfb6d49e8a49d517.tar.gz
chromium_src-8bd8aa1f07df8752a74e79bbcfb6d49e8a49d517.tar.bz2
Tweaks to BoundsAnimator/SlideAnimation and TabStrip:
. Adds unit test for BoundsAnimator and SlideAnimation. . Fixes leak in BoundsAnimator. . Fixes possibility of deleting delegate twice. . Makes sure delegate is notified when new animation is set for view. . Fixes crashes in TabStrip that resulted from dragging a tab back in. BUG=40475 TEST=make sure dragging tabs out/in to a tabstrip doesn't cause problems. Review URL: http://codereview.chromium.org/1585020 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43864 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'app')
-rw-r--r--app/app.gyp1
-rw-r--r--app/slide_animation_unittest.cc29
2 files changed, 30 insertions, 0 deletions
diff --git a/app/app.gyp b/app/app.gyp
index f87f721..3267c75 100644
--- a/app/app.gyp
+++ b/app/app.gyp
@@ -45,6 +45,7 @@
'l10n_util_unittest.cc',
'os_exchange_data_win_unittest.cc',
'run_all_unittests.cc',
+ 'slide_animation_unittest.cc',
'system_monitor_unittest.cc',
'test_suite.h',
'text_elider_unittest.cc',
diff --git a/app/slide_animation_unittest.cc b/app/slide_animation_unittest.cc
new file mode 100644
index 0000000..8bc947f
--- /dev/null
+++ b/app/slide_animation_unittest.cc
@@ -0,0 +1,29 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "app/slide_animation.h"
+#include "app/test_animation_delegate.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+class SlideAnimationTest: public testing::Test {
+ private:
+ MessageLoopForUI message_loop_;
+};
+
+// Tests that delegate is not notified when animation is running and is deleted.
+// (Such a scenario would cause problems for BoundsAnimator).
+TEST_F(SlideAnimationTest, DontNotifyOnDelete) {
+ TestAnimationDelegate delegate;
+ scoped_ptr<SlideAnimation> animation(new SlideAnimation(&delegate));
+
+ // Start the animation.
+ animation->Show();
+
+ // Delete the animation.
+ animation.reset();
+
+ // Make sure the delegate wasn't notified.
+ EXPECT_FALSE(delegate.finished());
+ EXPECT_FALSE(delegate.canceled());
+}