| 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 void AddInputEventObserver(InputEventObserver* observer) override {} | 99 void AddInputEventObserver(InputEventObserver* observer) override {} |
| 100 void RemoveInputEventObserver(InputEventObserver* observer) override {} | 100 void RemoveInputEventObserver(InputEventObserver* observer) override {} |
| 101 void GetWebScreenInfo(blink::WebScreenInfo* result) override {} | 101 void GetWebScreenInfo(blink::WebScreenInfo* result) override {} |
| 102 bool GetScreenColorProfile(std::vector<char>* color_profile) override { | 102 bool GetScreenColorProfile(std::vector<char>* color_profile) override { |
| 103 return false; } | 103 return false; } |
| 104 void HandleCompositorProto(const std::vector<uint8_t>& proto) override {} | 104 void HandleCompositorProto(const std::vector<uint8_t>& proto) override {} |
| 105 | 105 |
| 106 bool Send(IPC::Message* msg) override { return false; } | 106 bool Send(IPC::Message* msg) override { return false; } |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 class MockTextInputClient : public ui::TextInputClient { | 109 class MockTextInputClient : public ui::DummyTextInputClient { |
| 110 ui::TextInputType text_input_type_; | 110 public: |
| 111 MockTextInputClient() : DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT) {} |
| 111 | 112 |
| 112 public: | |
| 113 MockTextInputClient() : text_input_type_(ui::TEXT_INPUT_TYPE_TEXT) {} | |
| 114 ~MockTextInputClient() override {} | |
| 115 | |
| 116 void SetCompositionText(const ui::CompositionText& composition) override {} | |
| 117 void ConfirmCompositionText() override {} | |
| 118 void ClearCompositionText() override {} | |
| 119 void InsertText(const base::string16& text) override {} | |
| 120 void InsertChar(const ui::KeyEvent& event) override {} | |
| 121 ui::TextInputType GetTextInputType() const override { | |
| 122 return text_input_type_; | |
| 123 } | |
| 124 ui::TextInputMode GetTextInputMode() const override { | |
| 125 return ui::TEXT_INPUT_MODE_DEFAULT; | |
| 126 } | |
| 127 int GetTextInputFlags() const override { return 0; } | |
| 128 bool CanComposeInline() const override { return false; } | |
| 129 gfx::Rect GetCaretBounds() const override { return gfx::Rect(); } | |
| 130 bool GetCompositionCharacterBounds(uint32_t index, | |
| 131 gfx::Rect* rect) const override { | |
| 132 return false; | |
| 133 } | |
| 134 bool HasCompositionText() const override { return false; } | |
| 135 bool GetTextRange(gfx::Range* range) const override { return false; } | |
| 136 bool GetCompositionTextRange(gfx::Range* range) const override { | |
| 137 return false; | |
| 138 } | |
| 139 bool GetSelectionRange(gfx::Range* range) const override { return false; } | |
| 140 bool SetSelectionRange(const gfx::Range& range) override { return false; } | |
| 141 bool DeleteRange(const gfx::Range& range) override { return false; } | |
| 142 void OnInputMethodChanged() override {} | |
| 143 bool ChangeTextDirectionAndLayoutAlignment( | |
| 144 base::i18n::TextDirection direction) override { | |
| 145 return false; | |
| 146 } | |
| 147 void ExtendSelectionAndDelete(size_t before, size_t after) override {} | |
| 148 void EnsureCaretInRect(const gfx::Rect& rect) override {} | |
| 149 bool IsEditCommandEnabled(int command_id) override { return false; } | |
| 150 void SetEditCommandForNextKeyEvent(int command_id) override {} | |
| 151 bool GetTextFromRange(const gfx::Range& range, | 113 bool GetTextFromRange(const gfx::Range& range, |
| 152 base::string16* text) const override { | 114 base::string16* text) const override { |
| 153 *text = base::string16(base::ASCIIToUTF16("green apple")); | 115 *text = base::string16(base::ASCIIToUTF16("green apple")); |
| 154 return false; | 116 return false; |
| 155 } | 117 } |
| 156 }; | 118 }; |
| 157 | 119 |
| 158 MATCHER_P(CompMsgEquals, contents, "") { | 120 MATCHER_P(CompMsgEquals, contents, "") { |
| 159 if (contents.size() != arg.size()) | 121 if (contents.size() != arg.size()) |
| 160 return false; | 122 return false; |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 337 |
| 376 feature_.OnRenderWidgetCreated(1, &render_widget_host1_); | 338 feature_.OnRenderWidgetCreated(1, &render_widget_host1_); |
| 377 feature_.OnRenderWidgetCreated(2, &render_widget_host2_); | 339 feature_.OnRenderWidgetCreated(2, &render_widget_host2_); |
| 378 feature_.OnRenderWidgetInitialized(1, &render_widget_host1_); | 340 feature_.OnRenderWidgetInitialized(1, &render_widget_host1_); |
| 379 feature_.OnRenderWidgetDeleted(2, &render_widget_host2_); | 341 feature_.OnRenderWidgetDeleted(2, &render_widget_host2_); |
| 380 feature_.SendCompositorMessage(1, &render_widget_host1_, payload); | 342 feature_.SendCompositorMessage(1, &render_widget_host1_, payload); |
| 381 } | 343 } |
| 382 | 344 |
| 383 } // namespace engine | 345 } // namespace engine |
| 384 } // namespace blimp | 346 } // namespace blimp |
| OLD | NEW |