summaryrefslogtreecommitdiffstats
path: root/ui/aura/test/test_window_delegate.h
diff options
context:
space:
mode:
Diffstat (limited to 'ui/aura/test/test_window_delegate.h')
-rw-r--r--ui/aura/test/test_window_delegate.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/ui/aura/test/test_window_delegate.h b/ui/aura/test/test_window_delegate.h
index 4150f67..783402b 100644
--- a/ui/aura/test/test_window_delegate.h
+++ b/ui/aura/test/test_window_delegate.h
@@ -7,6 +7,7 @@
#pragma once
#include "base/compiler_specific.h"
+#include "third_party/skia/include/core/SkColor.h"
#include "ui/aura/window_delegate.h"
namespace aura {
@@ -41,6 +42,54 @@ class TestWindowDelegate : public WindowDelegate {
DISALLOW_COPY_AND_ASSIGN(TestWindowDelegate);
};
+// A simple WindowDelegate implementation for these tests. It owns itself
+// (deletes itself when the Window it is attached to is destroyed).
+class ColorTestWindowDelegate : public TestWindowDelegate {
+ public:
+ explicit ColorTestWindowDelegate(SkColor color);
+ virtual ~ColorTestWindowDelegate();
+
+ ui::KeyboardCode last_key_code() const { return last_key_code_; }
+
+ // Overridden from TestWindowDelegate:
+ virtual bool OnKeyEvent(KeyEvent* event) OVERRIDE;
+ virtual void OnWindowDestroyed() OVERRIDE;
+ virtual void OnPaint(gfx::Canvas* canvas) OVERRIDE;
+
+ private:
+ SkColor color_;
+ ui::KeyboardCode last_key_code_;
+
+ DISALLOW_COPY_AND_ASSIGN(ColorTestWindowDelegate);
+};
+
+class ActivateWindowDelegate : public TestWindowDelegate {
+ public:
+ ActivateWindowDelegate();
+ explicit ActivateWindowDelegate(bool activate);
+
+ 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;
+ }
+
+ // Overridden from TestWindowDelegate:
+ virtual bool ShouldActivate(Event* event) OVERRIDE;
+ virtual void OnActivated() OVERRIDE;
+ virtual void OnLostActive() OVERRIDE;
+
+ private:
+ bool activate_;
+ int activated_count_;
+ int lost_active_count_;
+ int should_activate_count_;
+
+ DISALLOW_COPY_AND_ASSIGN(ActivateWindowDelegate);
+};
+
} // namespace test
} // namespace aura