| OLD | NEW |
| 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 "net/base/net_errors.h" | 20 #include "net/base/net_errors.h" |
| 21 #include "net/base/test_completion_callback.h" | 21 #include "net/base/test_completion_callback.h" |
| 22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "third_party/WebKit/public/web/WebInputEvent.h" | 24 #include "third_party/WebKit/public/web/WebInputEvent.h" |
| 25 #include "ui/base/ime/text_input_client.h" | 25 #include "ui/base/ime/dummy_text_input_client.h" |
| 26 | 26 |
| 27 using testing::_; | 27 using testing::_; |
| 28 using testing::InSequence; | 28 using testing::InSequence; |
| 29 using testing::Sequence; | 29 using testing::Sequence; |
| 30 | 30 |
| 31 namespace blimp { | 31 namespace blimp { |
| 32 namespace engine { | 32 namespace engine { |
| 33 | 33 |
| 34 namespace { | 34 namespace { |
| 35 | 35 |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 void AddMouseEventCallback(const MouseEventCallback& callback) override {} | 96 void AddMouseEventCallback(const MouseEventCallback& callback) override {} |
| 97 void RemoveMouseEventCallback(const MouseEventCallback& callback) override {} | 97 void RemoveMouseEventCallback(const MouseEventCallback& callback) override {} |
| 98 void GetWebScreenInfo(blink::WebScreenInfo* result) override {} | 98 void GetWebScreenInfo(blink::WebScreenInfo* result) override {} |
| 99 bool GetScreenColorProfile(std::vector<char>* color_profile) override { | 99 bool GetScreenColorProfile(std::vector<char>* color_profile) override { |
| 100 return false; } | 100 return false; } |
| 101 void HandleCompositorProto(const std::vector<uint8_t>& proto) override {} | 101 void HandleCompositorProto(const std::vector<uint8_t>& proto) override {} |
| 102 | 102 |
| 103 bool Send(IPC::Message* msg) override { return false; } | 103 bool Send(IPC::Message* msg) override { return false; } |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 class MockTextInputClient : public ui::TextInputClient { | 106 class MockTextInputClient : public ui::DummyTextInputClient { |
| 107 ui::TextInputType text_input_type_; | |
| 108 | |
| 109 public: | 107 public: |
| 110 MockTextInputClient() : text_input_type_(ui::TEXT_INPUT_TYPE_TEXT) {} | 108 MockTextInputClient() : DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT) {} |
| 111 ~MockTextInputClient() override {} | 109 ~MockTextInputClient() override {} |
| 112 | 110 |
| 113 void SetCompositionText(const ui::CompositionText& composition) override {} | |
| 114 void ConfirmCompositionText() override {} | |
| 115 void ClearCompositionText() override {} | |
| 116 void InsertText(const base::string16& text) override {} | |
| 117 void InsertChar(const ui::KeyEvent& event) override {} | |
| 118 ui::TextInputType GetTextInputType() const override { | |
| 119 return text_input_type_; | |
| 120 } | |
| 121 ui::TextInputMode GetTextInputMode() const override { | |
| 122 return ui::TEXT_INPUT_MODE_DEFAULT; | |
| 123 } | |
| 124 int GetTextInputFlags() const override { return 0; } | |
| 125 bool CanComposeInline() const override { return false; } | |
| 126 gfx::Rect GetCaretBounds() const override { return gfx::Rect(); } | |
| 127 bool GetCompositionCharacterBounds(uint32_t index, | |
| 128 gfx::Rect* rect) const override { | |
| 129 return false; | |
| 130 } | |
| 131 bool HasCompositionText() const override { return false; } | |
| 132 bool GetTextRange(gfx::Range* range) const override { return false; } | |
| 133 bool GetCompositionTextRange(gfx::Range* range) const override { | |
| 134 return false; | |
| 135 } | |
| 136 bool GetSelectionRange(gfx::Range* range) const override { return false; } | |
| 137 bool SetSelectionRange(const gfx::Range& range) override { return false; } | |
| 138 bool DeleteRange(const gfx::Range& range) override { return false; } | |
| 139 void OnInputMethodChanged() override {} | |
| 140 bool ChangeTextDirectionAndLayoutAlignment( | |
| 141 base::i18n::TextDirection direction) override { | |
| 142 return false; | |
| 143 } | |
| 144 void ExtendSelectionAndDelete(size_t before, size_t after) override {} | |
| 145 void EnsureCaretInRect(const gfx::Rect& rect) override {} | |
| 146 bool IsEditCommandEnabled(int command_id) override { return false; } | |
| 147 void SetEditCommandForNextKeyEvent(int command_id) override {} | |
| 148 bool GetTextFromRange(const gfx::Range& range, | 111 bool GetTextFromRange(const gfx::Range& range, |
| 149 base::string16* text) const override { | 112 base::string16* text) const override { |
| 150 *text = base::string16(base::ASCIIToUTF16("green apple")); | 113 *text = base::string16(base::ASCIIToUTF16("green apple")); |
| 151 return false; | 114 return false; |
| 152 } | 115 } |
| 153 }; | 116 }; |
| 154 | 117 |
| 155 MATCHER_P(CompMsgEquals, contents, "") { | 118 MATCHER_P(CompMsgEquals, contents, "") { |
| 156 if (contents.size() != arg.size()) | 119 if (contents.size() != arg.size()) |
| 157 return false; | 120 return false; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 | 336 |
| 374 feature_.OnRenderWidgetCreated(1, &render_widget_host1_); | 337 feature_.OnRenderWidgetCreated(1, &render_widget_host1_); |
| 375 feature_.OnRenderWidgetCreated(2, &render_widget_host2_); | 338 feature_.OnRenderWidgetCreated(2, &render_widget_host2_); |
| 376 feature_.OnRenderWidgetInitialized(1, &render_widget_host1_); | 339 feature_.OnRenderWidgetInitialized(1, &render_widget_host1_); |
| 377 feature_.OnRenderWidgetDeleted(2, &render_widget_host2_); | 340 feature_.OnRenderWidgetDeleted(2, &render_widget_host2_); |
| 378 feature_.SendCompositorMessage(1, &render_widget_host1_, payload); | 341 feature_.SendCompositorMessage(1, &render_widget_host1_, payload); |
| 379 } | 342 } |
| 380 | 343 |
| 381 } // namespace engine | 344 } // namespace engine |
| 382 } // namespace blimp | 345 } // namespace blimp |
| OLD | NEW |