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

Side by Side Diff: blimp/engine/feature/engine_render_widget_feature_unittest.cc

Issue 2520013002: Reland of Extracting placeholder information from Webkit to Blimp (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "blimp/engine/feature/engine_render_widget_feature.h" 5 #include "blimp/engine/feature/engine_render_widget_feature.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/numerics/safe_conversions.h" 11 #include "base/numerics/safe_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "blimp/common/create_blimp_message.h" 13 #include "blimp/common/create_blimp_message.h"
14 #include "blimp/common/proto/blimp_message.pb.h" 14 #include "blimp/common/proto/blimp_message.pb.h"
15 #include "blimp/common/proto/compositor.pb.h" 15 #include "blimp/common/proto/compositor.pb.h"
16 #include "blimp/common/proto/render_widget.pb.h" 16 #include "blimp/common/proto/render_widget.pb.h"
17 #include "blimp/net/input_message_generator.h" 17 #include "blimp/net/input_message_generator.h"
18 #include "blimp/net/test_common.h" 18 #include "blimp/net/test_common.h"
19 #include "content/public/browser/render_widget_host.h" 19 #include "content/public/browser/render_widget_host.h"
20 #include "content/public/common/form_field_data.h"
20 #include "net/base/net_errors.h" 21 #include "net/base/net_errors.h"
21 #include "net/base/test_completion_callback.h" 22 #include "net/base/test_completion_callback.h"
22 #include "testing/gmock/include/gmock/gmock.h" 23 #include "testing/gmock/include/gmock/gmock.h"
23 #include "testing/gtest/include/gtest/gtest.h" 24 #include "testing/gtest/include/gtest/gtest.h"
24 #include "third_party/WebKit/public/platform/WebInputEvent.h" 25 #include "third_party/WebKit/public/platform/WebInputEvent.h"
25 #include "ui/base/ime/dummy_text_input_client.h" 26 #include "ui/base/ime/dummy_text_input_client.h"
26 27
27 using testing::_; 28 using testing::_;
28 using testing::InSequence; 29 using testing::InSequence;
29 using testing::Sequence; 30 using testing::Sequence;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 EXPECT_CALL( 258 EXPECT_CALL(
258 *ime_message_sender_, 259 *ime_message_sender_,
259 MockableProcessMessage(BlimpImeMsgEquals(2, 1, ImeMessage::SHOW_IME, 260 MockableProcessMessage(BlimpImeMsgEquals(2, 1, ImeMessage::SHOW_IME,
260 std::string("green apple"), 1), 261 std::string("green apple"), 1),
261 _)); 262 _));
262 263
263 EXPECT_CALL( 264 EXPECT_CALL(
264 *ime_message_sender_, 265 *ime_message_sender_,
265 MockableProcessMessage(BlimpImeMsgEquals(2, ImeMessage::HIDE_IME), _)); 266 MockableProcessMessage(BlimpImeMsgEquals(2, ImeMessage::HIDE_IME), _));
266 267
268 content::FormFieldData field;
269 field.text = "green apple";
270 field.placeholder = "fruit name";
271 field.text_input_type = ui::TEXT_INPUT_TYPE_TEXT;
272
267 feature_.OnRenderWidgetCreated(2, &render_widget_host1_); 273 feature_.OnRenderWidgetCreated(2, &render_widget_host1_);
268 feature_.SendShowImeRequest(2, &render_widget_host1_, &text_input_client_); 274 feature_.SendShowImeRequest(2, &render_widget_host1_, field);
269 feature_.SendHideImeRequest(2, &render_widget_host1_); 275 feature_.SendHideImeRequest(2, &render_widget_host1_);
270 } 276 }
271 277
272 TEST_F(EngineRenderWidgetFeatureTest, DropsStaleMessages) { 278 TEST_F(EngineRenderWidgetFeatureTest, DropsStaleMessages) {
273 InSequence sequence; 279 InSequence sequence;
274 std::vector<uint8_t> payload = { 'f', 'u', 'n' }; 280 std::vector<uint8_t> payload = { 'f', 'u', 'n' };
275 std::vector<uint8_t> new_payload = {'n', 'o', ' ', 'f', 'u', 'n'}; 281 std::vector<uint8_t> new_payload = {'n', 'o', ' ', 'f', 'u', 'n'};
276 282
277 EXPECT_CALL(*render_widget_message_sender_, 283 EXPECT_CALL(*render_widget_message_sender_,
278 MockableProcessMessage( 284 MockableProcessMessage(
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 340
335 feature_.OnRenderWidgetCreated(1, &render_widget_host1_); 341 feature_.OnRenderWidgetCreated(1, &render_widget_host1_);
336 feature_.OnRenderWidgetCreated(2, &render_widget_host2_); 342 feature_.OnRenderWidgetCreated(2, &render_widget_host2_);
337 feature_.OnRenderWidgetInitialized(1, &render_widget_host1_); 343 feature_.OnRenderWidgetInitialized(1, &render_widget_host1_);
338 feature_.OnRenderWidgetDeleted(2, &render_widget_host2_); 344 feature_.OnRenderWidgetDeleted(2, &render_widget_host2_);
339 feature_.SendCompositorMessage(1, &render_widget_host1_, payload); 345 feature_.SendCompositorMessage(1, &render_widget_host1_, payload);
340 } 346 }
341 347
342 } // namespace engine 348 } // namespace engine
343 } // namespace blimp 349 } // namespace blimp
OLDNEW
« no previous file with comments | « blimp/engine/feature/engine_render_widget_feature.cc ('k') | blimp/engine/session/blimp_engine_session.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698