Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(266)

Unified Diff: ui/views/event_monitor_mac_unittest.mm

Issue 793003004: MacViews: Implement event monitoring for a specific window (Reland) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/event_monitor_mac.mm ('k') | ui/views/event_monitor_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/event_monitor_mac_unittest.mm
diff --git a/ui/views/event_monitor_mac_unittest.mm b/ui/views/event_monitor_mac_unittest.mm
deleted file mode 100644
index c6879a7967ad0670c03eb8e5f350c1addfc42689..0000000000000000000000000000000000000000
--- a/ui/views/event_monitor_mac_unittest.mm
+++ /dev/null
@@ -1,67 +0,0 @@
-// 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 "ui/views/event_monitor_mac.h"
-
-#include "ui/events/event.h"
-#include "ui/events/event_handler.h"
-#include "ui/events/event_constants.h"
-#import "ui/events/test/cocoa_test_event_utils.h"
-#import "ui/gfx/test/ui_cocoa_test_helper.h"
-
-namespace views {
-
-namespace {
-
-class EventMonitorMacTest : public ui::CocoaTest {
- public:
- EventMonitorMacTest() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(EventMonitorMacTest);
-};
-
-class EventCounter : public ui::EventHandler {
- public:
- EventCounter() : event_count_(0), last_event_type_(ui::ET_UNKNOWN) {}
- int event_count() const { return event_count_; }
- ui::EventType last_event_type() { return last_event_type_; }
-
- // ui::EventHandler implementation:
- virtual void OnEvent(ui::Event* event) override {
- ++event_count_;
- last_event_type_ = event->type();
- }
-
- private:
- int event_count_;
- ui::EventType last_event_type_;
-};
-
-} // namespace
-
-TEST_F(EventMonitorMacTest, CountEvents) {
- EventCounter counter;
- NSEvent* event =
- cocoa_test_event_utils::EnterExitEventWithType(NSMouseExited);
-
- // No monitor installed yet, should not receive events.
- [NSApp sendEvent:event];
- EXPECT_EQ(0, counter.event_count());
- EXPECT_EQ(ui::ET_UNKNOWN, counter.last_event_type());
-
- // Install monitor, should start receiving event.
- scoped_ptr<EventMonitor> event_monitor(EventMonitor::Create(&counter));
- [NSApp sendEvent:event];
- EXPECT_EQ(1, counter.event_count());
- EXPECT_EQ(ui::ET_MOUSE_EXITED, counter.last_event_type());
-
- // Uninstall monitor, should stop receiving events.
- event_monitor.reset();
- [NSApp sendEvent:event];
- EXPECT_EQ(1, counter.event_count());
- EXPECT_EQ(ui::ET_MOUSE_EXITED, counter.last_event_type());
-}
-
-} // namespace views
« no previous file with comments | « ui/views/event_monitor_mac.mm ('k') | ui/views/event_monitor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698