diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-23 22:40:52 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-23 22:40:52 +0000 |
commit | 2f74428eee5f226ccdba805b91bd7e45a0f7a4e4 (patch) | |
tree | 7bba8d381a8f4f46f487f92cd5ce81e978d0114a /ash/test/test_activation_delegate.h | |
parent | eb929d6e96d746d808f1083dd54d7514e4c45e85 (diff) | |
download | chromium_src-2f74428eee5f226ccdba805b91bd7e45a0f7a4e4.zip chromium_src-2f74428eee5f226ccdba805b91bd7e45a0f7a4e4.tar.gz chromium_src-2f74428eee5f226ccdba805b91bd7e45a0f7a4e4.tar.bz2 |
More stuff -> ash
http://crbug.com/108457
TEST=none
TBR=sky
Review URL: http://codereview.chromium.org/9033006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115741 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/test/test_activation_delegate.h')
-rw-r--r-- | ash/test/test_activation_delegate.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/ash/test/test_activation_delegate.h b/ash/test/test_activation_delegate.h new file mode 100644 index 0000000..d799745 --- /dev/null +++ b/ash/test/test_activation_delegate.h @@ -0,0 +1,59 @@ +// Copyright (c) 2011 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_ACTIVATION_DELEGATE_H_ +#define ASH_TEST_TEST_ACTIVATION_DELEGATE_H_ +#pragma once + +#include "base/compiler_specific.h" +#include "base/logging.h" +#include "ui/aura/client/activation_delegate.h" + +namespace aura { +class Window; +} + +namespace aura_shell { +namespace test { + +// A test ActivationDelegate that can be used to track activation changes for +// an aura::Window. +class TestActivationDelegate : public aura::client::ActivationDelegate { + public: + TestActivationDelegate(); + explicit TestActivationDelegate(bool activate); + + // Associates this delegate with a Window. + void SetWindow(aura::Window* window); + + bool window_was_active() const { return window_was_active_; } + void set_activate(bool v) { activate_ = v; } + int activated_count() const { return activated_count_; } + int lost_active_count() const { return lost_active_count_; } + int should_activate_count() const { return should_activate_count_; } + void Clear() { + activated_count_ = lost_active_count_ = should_activate_count_ = 0; + window_was_active_ = false; + } + + // Overridden from client::ActivationDelegate: + virtual bool ShouldActivate(aura::Event* event) OVERRIDE; + virtual void OnActivated() OVERRIDE; + virtual void OnLostActive() OVERRIDE; + + private: + aura::Window* window_; + bool window_was_active_; + bool activate_; + int activated_count_; + int lost_active_count_; + int should_activate_count_; + + DISALLOW_COPY_AND_ASSIGN(TestActivationDelegate); +}; + +} // namespace test +} // namespace aura_shell + +#endif // ASH_TEST_TEST_ACTIVATION_DELEGATE_H_ |