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

Unified Diff: ui/views/mus/input_method_mus_unittest.cc

Issue 2611773002: Removes code using mus client lib (Closed)
Patch Set: dont run on linux Created 3 years, 12 months 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/mus/input_method_mus.cc ('k') | ui/views/mus/interactive_ui_tests_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/mus/input_method_mus_unittest.cc
diff --git a/ui/views/mus/input_method_mus_unittest.cc b/ui/views/mus/input_method_mus_unittest.cc
deleted file mode 100644
index 5ce1d360253b2dc145f7cfae088900a613a93a46..0000000000000000000000000000000000000000
--- a/ui/views/mus/input_method_mus_unittest.cc
+++ /dev/null
@@ -1,98 +0,0 @@
-// Copyright 2016 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/mus/input_method_mus.h"
-
-#include <memory>
-
-#include "base/memory/ptr_util.h"
-#include "base/message_loop/message_loop.h"
-#include "base/run_loop.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/base/ime/dummy_text_input_client.h"
-#include "ui/base/ime/input_method_delegate.h"
-#include "ui/events/event.h"
-#include "ui/views/mus/window_manager_connection.h"
-#include "ui/views/test/scoped_views_test_helper.h"
-
-namespace views {
-namespace {
-
-class TestInputMethodDelegate : public ui::internal::InputMethodDelegate {
- public:
- TestInputMethodDelegate() {}
- ~TestInputMethodDelegate() override {}
-
- // ui::internal::InputMethodDelegate:
- ui::EventDispatchDetails DispatchKeyEventPostIME(
- ui::KeyEvent* key_event) override {
- return ui::EventDispatchDetails();
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TestInputMethodDelegate);
-};
-
-class TestTextInputClient : public ui::DummyTextInputClient {
- public:
- TestTextInputClient() {}
- ~TestTextInputClient() override {}
-
- ui::KeyEvent* WaitUntilInputReceieved() {
- run_loop_ = base::MakeUnique<base::RunLoop>();
- run_loop_->Run();
- run_loop_.reset();
-
- return received_event_->AsKeyEvent();
- }
-
- // ui::DummyTextInputClient:
- void InsertChar(const ui::KeyEvent& event) override {
- received_event_ = ui::Event::Clone(event);
- run_loop_->Quit();
- }
-
- private:
- std::unique_ptr<base::RunLoop> run_loop_;
- std::unique_ptr<ui::Event> received_event_;
-
- DISALLOW_COPY_AND_ASSIGN(TestTextInputClient);
-};
-
-} // namespace
-
-class InputMethodMusTest : public testing::Test {
- public:
- InputMethodMusTest() : message_loop_(base::MessageLoop::TYPE_UI) {}
- ~InputMethodMusTest() override {}
-
- service_manager::Connector* connector() {
- return WindowManagerConnection::Get()->connector();
- }
-
- private:
- base::MessageLoop message_loop_;
- ScopedViewsTestHelper helper_;
-
- DISALLOW_COPY_AND_ASSIGN(InputMethodMusTest);
-};
-
-TEST_F(InputMethodMusTest, DispatchKeyEvent) {
- TestInputMethodDelegate input_method_delegate;
- InputMethodMus input_method(&input_method_delegate, nullptr);
- input_method.Init(connector());
-
- TestTextInputClient text_input_client;
- input_method.SetFocusedTextInputClient(&text_input_client);
-
- ui::KeyEvent key_event('A', ui::VKEY_A, 0);
- input_method.DispatchKeyEvent(&key_event);
-
- ui::KeyEvent* received_event = text_input_client.WaitUntilInputReceieved();
- EXPECT_EQ(ui::ET_KEY_PRESSED, received_event->type());
- EXPECT_TRUE(received_event->is_char());
- EXPECT_EQ(key_event.GetCharacter(), received_event->GetCharacter());
-}
-
-} // namespace views
« no previous file with comments | « ui/views/mus/input_method_mus.cc ('k') | ui/views/mus/interactive_ui_tests_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698