overlay_event_filter_unittest.cc 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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. #include "ash/wm/overlay_event_filter.h"
  5. #include "ash/shell.h"
  6. #include "ash/test/ash_test_base.h"
  7. #include "ash/wm/test_overlay_delegate.h"
  8. namespace ash {
  9. using OverlayEventFilterTest = AshTestBase;
  10. // Tests of the multiple overlay delegates attempt to activate, in that case
  11. // Cancel() of the existing delegate should be called.
  12. // See http://crbug.com/341958
  13. TEST_F(OverlayEventFilterTest, CancelAtActivating) {
  14. TestOverlayDelegate d1;
  15. TestOverlayDelegate d2;
  16. Shell::Get()->overlay_filter()->Activate(&d1);
  17. EXPECT_EQ(0, d1.GetCancelCountAndReset());
  18. EXPECT_EQ(0, d2.GetCancelCountAndReset());
  19. Shell::Get()->overlay_filter()->Activate(&d2);
  20. EXPECT_EQ(1, d1.GetCancelCountAndReset());
  21. EXPECT_EQ(0, d2.GetCancelCountAndReset());
  22. Shell::Get()->overlay_filter()->Cancel();
  23. EXPECT_EQ(0, d1.GetCancelCountAndReset());
  24. EXPECT_EQ(1, d2.GetCancelCountAndReset());
  25. }
  26. } // namespace ash