summaryrefslogtreecommitdiffstats
path: root/ui/aura/test/test_window_delegate.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ui/aura/test/test_window_delegate.cc')
-rw-r--r--ui/aura/test/test_window_delegate.cc57
1 files changed, 57 insertions, 0 deletions
diff --git a/ui/aura/test/test_window_delegate.cc b/ui/aura/test/test_window_delegate.cc
index 8957eba..b179fda 100644
--- a/ui/aura/test/test_window_delegate.cc
+++ b/ui/aura/test/test_window_delegate.cc
@@ -4,11 +4,18 @@
#include "ui/aura/test/test_window_delegate.h"
+#include "third_party/skia/include/core/SkCanvas.h"
+#include "ui/aura/event.h"
+#include "ui/aura/window.h"
#include "ui/base/hit_test.h"
+#include "ui/gfx/canvas.h"
namespace aura {
namespace test {
+////////////////////////////////////////////////////////////////////////////////
+// TestWindowDelegate
+
TestWindowDelegate::TestWindowDelegate() {
}
@@ -70,5 +77,55 @@ void TestWindowDelegate::OnWindowDestroyed() {
void TestWindowDelegate::OnWindowVisibilityChanged(bool visible) {
}
+
+////////////////////////////////////////////////////////////////////////////////
+// ColorTestWindowDelegate
+
+ColorTestWindowDelegate::ColorTestWindowDelegate(SkColor color)
+ : color_(color),
+ last_key_code_(ui::VKEY_UNKNOWN) {
+}
+ColorTestWindowDelegate::~ColorTestWindowDelegate() {
+}
+
+bool ColorTestWindowDelegate::OnKeyEvent(KeyEvent* event) {
+ last_key_code_ = event->key_code();
+ return true;
+}
+void ColorTestWindowDelegate::OnWindowDestroyed() {
+ delete this;
+}
+void ColorTestWindowDelegate::OnPaint(gfx::Canvas* canvas) {
+ canvas->GetSkCanvas()->drawColor(color_, SkXfermode::kSrc_Mode);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// ActivateWindowDelegate
+
+ActivateWindowDelegate::ActivateWindowDelegate()
+ : activate_(true),
+ activated_count_(0),
+ lost_active_count_(0),
+ should_activate_count_(0) {
+}
+
+ActivateWindowDelegate::ActivateWindowDelegate(bool activate)
+ : activate_(activate),
+ activated_count_(0),
+ lost_active_count_(0),
+ should_activate_count_(0) {
+}
+
+bool ActivateWindowDelegate::ShouldActivate(Event* event) {
+ should_activate_count_++;
+ return activate_;
+}
+void ActivateWindowDelegate::OnActivated() {
+ activated_count_++;
+}
+void ActivateWindowDelegate::OnLostActive() {
+ lost_active_count_++;
+}
+
} // namespace test
} // namespace aura