Index: components/keyboard_lock/keyboard_lock_host_unittest.cc |
diff --git a/components/keyboard_lock/keyboard_lock_host_unittest.cc b/components/keyboard_lock/keyboard_lock_host_unittest.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..79990a2e01a2add1da22da00e9516622a1734393 |
--- /dev/null |
+++ b/components/keyboard_lock/keyboard_lock_host_unittest.cc |
@@ -0,0 +1,38 @@ |
+// Copyright 2017 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 "components/keyboard_lock/keyboard_lock_host.h" |
+ |
+#include "components/keyboard_lock/key_event_interceptor_installer.h" |
+#include "testing/gtest/include/gtest/gtest.h" |
+ |
+namespace keyboard_lock { |
+ |
+namespace { |
+ |
+class FakeKeyEventInterceptor : public KeyEventInterceptorInstaller { |
+ public: |
+ FakeKeyEventInterceptor(KeyboardLockHost* host) |
+ : KeyEventInterceptorInstaller(host) {} |
+ ~FakeKeyEventInterceptor() override { deleted_count++; } |
+ |
+ bool OnKeyDown(ui::KeyboardCode code) override { return false; } |
+ bool OnKeyUp(ui::KeyboardCode code) override { return false; } |
+ |
+ static int deleted_count; |
+}; |
+ |
+int FakeKeyEventInterceptor::deleted_count = 0; |
+} |
+ |
+TEST(KeyboardLockHostTest, KeyEventInterceptorInstallationTest) { |
+ { |
+ KeyboardLockHost host; |
+ FakeKeyEventInterceptor* interceptor = new FakeKeyEventInterceptor(&host); |
+ ASSERT_EQ(interceptor, host.interceptor()); |
+ } |
+ ASSERT_EQ(FakeKeyEventInterceptor::deleted_count, 1); |
+} |
+ |
+} // namespace keyboard_lock |