diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-13 04:04:13 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-08-13 04:05:35 +0000 |
commit | aa1da928a71b3120283045480b03eb945500f7cf (patch) | |
tree | 99c06e62f986d90cd23fe09f3d089ae9af3d5cf5 /ash/test | |
parent | e578cf31a5948727a11bec37fae0fba059d7f13f (diff) | |
download | chromium_src-aa1da928a71b3120283045480b03eb945500f7cf.zip chromium_src-aa1da928a71b3120283045480b03eb945500f7cf.tar.gz chromium_src-aa1da928a71b3120283045480b03eb945500f7cf.tar.bz2 |
Fix the bug of multiple overlays.
- keyboard overlay and partial_screenshot overlay should do nothing
if there are already overlays.
- overlay_event_filter should cancel the existing delegate if
another delegate is trying to activate.
BUG=341958
R=jamescook@chromium.org
TEST=manually
Review URL: https://codereview.chromium.org/461093003
Cr-Commit-Position: refs/heads/master@{#289199}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test')
-rw-r--r-- | ash/test/test_overlay_delegate.cc | 33 | ||||
-rw-r--r-- | ash/test/test_overlay_delegate.h | 34 |
2 files changed, 67 insertions, 0 deletions
diff --git a/ash/test/test_overlay_delegate.cc b/ash/test/test_overlay_delegate.cc new file mode 100644 index 0000000..404e909 --- /dev/null +++ b/ash/test/test_overlay_delegate.cc @@ -0,0 +1,33 @@ +// Copyright 2014 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 "ash/test/test_overlay_delegate.h" + +namespace ash { +namespace test { + +TestOverlayDelegate::TestOverlayDelegate() + : cancel_count_(0) {} +TestOverlayDelegate::~TestOverlayDelegate() {} + +int TestOverlayDelegate::GetCancelCountAndReset() { + int count = cancel_count_; + cancel_count_ = 0; + return count; +} + +void TestOverlayDelegate::Cancel() { + ++cancel_count_; +} + +bool TestOverlayDelegate::IsCancelingKeyEvent(ui::KeyEvent* event) { + return false; +} + +aura::Window* TestOverlayDelegate::GetWindow() { + return NULL; +} + +} // namespace test +} // namespace ash diff --git a/ash/test/test_overlay_delegate.h b/ash/test/test_overlay_delegate.h new file mode 100644 index 0000000..d43903f --- /dev/null +++ b/ash/test/test_overlay_delegate.h @@ -0,0 +1,34 @@ +// Copyright 2014 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. + +#ifndef ASH_TEST_TEST_OVERLAY_DELEGATE_H_ +#define ASH_TEST_TEST_OVERLAY_DELEGATE_H_ + +#include "ash/wm/overlay_event_filter.h" + +namespace ash { +namespace test { + +class TestOverlayDelegate : public OverlayEventFilter::Delegate { + public: + TestOverlayDelegate(); + virtual ~TestOverlayDelegate(); + + int GetCancelCountAndReset(); + + private: + // Overridden from OverlayEventFilter::Delegate: + virtual void Cancel() OVERRIDE; + virtual bool IsCancelingKeyEvent(ui::KeyEvent* event) OVERRIDE; + virtual aura::Window* GetWindow() OVERRIDE; + + int cancel_count_; + + DISALLOW_COPY_AND_ASSIGN(TestOverlayDelegate); +}; + +} // namespace test +} // namespace ash + +#endif // ASH_TEST_TEST_OVERLAY_DELEGATE_H_ |