1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/wm/overlay_event_filter.h"
8 #include "ash/test/ash_test_base.h"
9 #include "ash/test/test_overlay_delegate.h"
14 typedef AshTestBase OverlayEventFilterTest;
16 // Tests of the multiple overlay delegates attempt to activate, in that case
17 // Cancel() of the existing delegate should be called.
18 // See http://crbug.com/341958
19 TEST_F(OverlayEventFilterTest, CancelAtActivating) {
20 TestOverlayDelegate d1;
21 TestOverlayDelegate d2;
23 Shell::GetInstance()->overlay_filter()->Activate(&d1);
24 EXPECT_EQ(0, d1.GetCancelCountAndReset());
25 EXPECT_EQ(0, d2.GetCancelCountAndReset());
27 Shell::GetInstance()->overlay_filter()->Activate(&d2);
28 EXPECT_EQ(1, d1.GetCancelCountAndReset());
29 EXPECT_EQ(0, d2.GetCancelCountAndReset());
31 Shell::GetInstance()->overlay_filter()->Cancel();
32 EXPECT_EQ(0, d1.GetCancelCountAndReset());
33 EXPECT_EQ(1, d2.GetCancelCountAndReset());