| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/memory/ptr_util.h" | 5 #include "base/memory/ptr_util.h" |
| 6 #include "blimp/client/app/session/test_client_session.h" | 6 #include "blimp/client/app/session/test_client_session.h" |
| 7 #include "blimp/client/core/contents/ime_feature.h" | 7 #include "blimp/client/core/contents/ime_feature.h" |
| 8 #include "blimp/client/core/contents/mock_ime_feature_delegate.h" | 8 #include "blimp/client/core/contents/mock_ime_feature_delegate.h" |
| 9 #include "blimp/client/core/contents/mock_navigation_feature_delegate.h" | 9 #include "blimp/client/core/contents/mock_navigation_feature_delegate.h" |
| 10 #include "blimp/client/core/contents/navigation_feature.h" | 10 #include "blimp/client/core/contents/navigation_feature.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 | 113 |
| 114 private: | 114 private: |
| 115 DISALLOW_COPY_AND_ASSIGN(InputBrowserTest); | 115 DISALLOW_COPY_AND_ASSIGN(InputBrowserTest); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 IN_PROC_BROWSER_TEST_F(InputBrowserTest, InputText) { | 118 IN_PROC_BROWSER_TEST_F(InputBrowserTest, InputText) { |
| 119 LoadPage(kInputPagePath); | 119 LoadPage(kInputPagePath); |
| 120 | 120 |
| 121 blink::WebGestureEvent event; | 121 blink::WebGestureEvent event; |
| 122 event.type = blink::WebInputEvent::Type::GestureTap; | 122 event.type = blink::WebInputEvent::Type::GestureTap; |
| 123 client::ImeFeature::ShowImeCallback callback; | 123 client::ImeFeature::WebInputRequest request; |
| 124 | 124 |
| 125 // Send a tap event from the client and expect the IME dialog to show. | 125 // Send a tap event from the client and expect the IME dialog to show. |
| 126 EXPECT_CALL(client_ime_feature_delegate_, OnShowImeRequested(_, "", _)) | 126 EXPECT_CALL(client_ime_feature_delegate_, OnShowImeRequested(_)) |
| 127 .Times(AtLeast(1)) | 127 .Times(AtLeast(1)) |
| 128 .WillOnce( | 128 .WillOnce( |
| 129 DoAll(InvokeWithoutArgs(this, &InputBrowserTest::SignalCompletion), | 129 DoAll(InvokeWithoutArgs(this, &InputBrowserTest::SignalCompletion), |
| 130 SaveArg<2>(&callback))); | 130 SaveArg<0>(&request))); |
| 131 client_session_->GetRenderWidgetFeature()->SendWebGestureEvent(kDummyTabId, 1, | 131 client_session_->GetRenderWidgetFeature()->SendWebGestureEvent(kDummyTabId, 1, |
| 132 event); | 132 event); |
| 133 RunAndVerify(); | 133 RunAndVerify(); |
| 134 | 134 |
| 135 // Enter text from the client and expect the input.html JavaScript to update | 135 // Enter text from the client and expect the input.html JavaScript to update |
| 136 // the page title. | 136 // the page title. |
| 137 EXPECT_CALL(client_nav_feature_delegate_, OnTitleChanged(kDummyTabId, "test")) | 137 EXPECT_CALL(client_nav_feature_delegate_, OnTitleChanged(kDummyTabId, "test")) |
| 138 .WillOnce(InvokeWithoutArgs(this, &InputBrowserTest::SignalCompletion)); | 138 .WillOnce(InvokeWithoutArgs(this, &InputBrowserTest::SignalCompletion)); |
| 139 callback.Run("test"); | 139 |
| 140 client::ImeFeature::WebInputResponse response(request); |
| 141 response.text = "test"; |
| 142 client_session_->GetImeFeature()->OnImeTextEntered(response); |
| 143 |
| 140 RunAndVerify(); | 144 RunAndVerify(); |
| 141 } | 145 } |
| 142 | 146 |
| 143 } // namespace | 147 } // namespace |
| 144 } // namespace blimp | 148 } // namespace blimp |
| OLD | NEW |