Home | History | Annotate | Download | only in wm
      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.
      4 
      5 #include "ash/wm/overlay_event_filter.h"
      6 
      7 #include "ash/shell.h"
      8 #include "ash/test/ash_test_base.h"
      9 #include "ash/test/test_overlay_delegate.h"
     10 
     11 namespace ash {
     12 namespace test {
     13 
     14 typedef AshTestBase OverlayEventFilterTest;
     15 
     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;
     22 
     23   Shell::GetInstance()->overlay_filter()->Activate(&d1);
     24   EXPECT_EQ(0, d1.GetCancelCountAndReset());
     25   EXPECT_EQ(0, d2.GetCancelCountAndReset());
     26 
     27   Shell::GetInstance()->overlay_filter()->Activate(&d2);
     28   EXPECT_EQ(1, d1.GetCancelCountAndReset());
     29   EXPECT_EQ(0, d2.GetCancelCountAndReset());
     30 
     31   Shell::GetInstance()->overlay_filter()->Cancel();
     32   EXPECT_EQ(0, d1.GetCancelCountAndReset());
     33   EXPECT_EQ(1, d2.GetCancelCountAndReset());
     34 }
     35 
     36 }  // namespace test
     37 }  // namespace ash
     38