summaryrefslogtreecommitdiffstats
path: root/ash/wm/activation_controller_unittest.cc
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-18 01:03:06 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-18 01:03:06 +0000
commitf8892656467b06fa87f3e75091f6b940f203623b (patch)
tree8234ffd6fcb67b5b088c4d3d3451bb1ac977acc4 /ash/wm/activation_controller_unittest.cc
parentf0da96eb74cc3997a134b5ecd6a3f8255d283a56 (diff)
downloadchromium_src-f8892656467b06fa87f3e75091f6b940f203623b.zip
chromium_src-f8892656467b06fa87f3e75091f6b940f203623b.tar.gz
chromium_src-f8892656467b06fa87f3e75091f6b940f203623b.tar.bz2
Deactivate active window even if there is no next window to activate
Deactivated/deleted window was staying active at shutdown, and window being deleted didn't receive OnLostActive. BUG=114123 TEST=tbd Review URL: http://codereview.chromium.org/9348115 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122650 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/wm/activation_controller_unittest.cc')
-rw-r--r--ash/wm/activation_controller_unittest.cc23
1 files changed, 17 insertions, 6 deletions
diff --git a/ash/wm/activation_controller_unittest.cc b/ash/wm/activation_controller_unittest.cc
index c67a58b..6500e9e 100644
--- a/ash/wm/activation_controller_unittest.cc
+++ b/ash/wm/activation_controller_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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.
@@ -194,19 +194,30 @@ TEST_F(ActivationControllerTest, NotActiveInLostActive) {
// Activate w1.
ActivateWindow(w1.get());
EXPECT_TRUE(IsActiveWindow(w1.get()));
-
+ EXPECT_EQ(1, ad1.activated_count());
// Should not have gotten a OnLostActive yet.
EXPECT_EQ(0, ad1.lost_active_count());
- // ActivateWindow(NULL) should not change the active window.
+ // ActivateWindow(NULL) should deactivate the active window.
ActivateWindow(NULL);
- EXPECT_TRUE(IsActiveWindow(w1.get()));
+ EXPECT_FALSE(IsActiveWindow(w1.get()));
+ EXPECT_EQ(1, ad1.lost_active_count());
+ EXPECT_FALSE(ad1.window_was_active());
+
+ // Activate w1 again. w1 should have gotten OnActivated.
+ ActivateWindow(w1.get());
+ EXPECT_EQ(2, ad1.activated_count());
+ EXPECT_EQ(1, ad1.lost_active_count());
+
+ // Reset the delegate.
+ ad1.Clear();
// Now activate another window.
ActivateWindow(w2.get());
- // Should have gotten OnLostActive and w1 should not have been active at that
- // time.
+ // Should have gotten OnLostActive and w1 shoouldn't have been
+ // active window in OnLostActive.
+ EXPECT_EQ(0, ad1.activated_count());
EXPECT_EQ(1, ad1.lost_active_count());
EXPECT_FALSE(ad1.window_was_active());
}