| 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 #ifndef CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| 6 #define CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 virtual ~TextInputManagerTester(); | 46 virtual ~TextInputManagerTester(); |
| 47 | 47 |
| 48 // Sets a callback which is invoked when a RWHV calls UpdateTextInputState | 48 // Sets a callback which is invoked when a RWHV calls UpdateTextInputState |
| 49 // on the TextInputManager which is being observed. | 49 // on the TextInputManager which is being observed. |
| 50 void SetUpdateTextInputStateCalledCallback(const base::Closure& callback); | 50 void SetUpdateTextInputStateCalledCallback(const base::Closure& callback); |
| 51 | 51 |
| 52 // Sets a callback which is invoked when a RWHV calls SelectionBoundsChanged | 52 // Sets a callback which is invoked when a RWHV calls SelectionBoundsChanged |
| 53 // on the TextInputManager which is being observed. | 53 // on the TextInputManager which is being observed. |
| 54 void SetOnSelectionBoundsChangedCallback(const base::Closure& callback); | 54 void SetOnSelectionBoundsChangedCallback(const base::Closure& callback); |
| 55 | 55 |
| 56 // Sets a callback which is invoked when a RWHV calls SelectionChanged on the |
| 57 // TextInputManager which is being observed. |
| 58 void SetOnTextSelectionChangedCallback(const base::Closure& callback); |
| 59 |
| 56 // Returns true if there is a focused <input> and populates |type| with | 60 // Returns true if there is a focused <input> and populates |type| with |
| 57 // |TextInputState.type| of the TextInputManager. | 61 // |TextInputState.type| of the TextInputManager. |
| 58 bool GetTextInputType(ui::TextInputType* type); | 62 bool GetTextInputType(ui::TextInputType* type); |
| 59 | 63 |
| 60 // Returns true if there is a focused <input> and populates |value| with | 64 // Returns true if there is a focused <input> and populates |value| with |
| 61 // |TextInputState.value| of the TextInputManager. | 65 // |TextInputState.value| of the TextInputManager. |
| 62 bool GetTextInputValue(std::string* value); | 66 bool GetTextInputValue(std::string* value); |
| 63 | 67 |
| 68 // Returns true if there is a focused <input> and populates |length| with the |
| 69 // length of the selected text range in the focused view. |
| 70 bool GetCurrentTextSelectionLength(size_t* length); |
| 71 |
| 64 // Returns the RenderWidgetHostView with a focused <input> element or nullptr | 72 // Returns the RenderWidgetHostView with a focused <input> element or nullptr |
| 65 // if none exists. | 73 // if none exists. |
| 66 const RenderWidgetHostView* GetActiveView(); | 74 const RenderWidgetHostView* GetActiveView(); |
| 67 | 75 |
| 68 // Returns the RenderWidgetHostView which has most recently updated any of its | 76 // Returns the RenderWidgetHostView which has most recently updated any of its |
| 69 // state (e.g., TextInputState or otherwise). | 77 // state (e.g., TextInputState or otherwise). |
| 70 const RenderWidgetHostView* GetUpdatedView(); | 78 const RenderWidgetHostView* GetUpdatedView(); |
| 71 | 79 |
| 72 // Returns true if a call to TextInputManager::UpdateTextInputState has led | 80 // Returns true if a call to TextInputManager::UpdateTextInputState has led |
| 73 // to a change in TextInputState (since the time the observer has been | 81 // to a change in TextInputState (since the time the observer has been |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 const base::Closure& callback) = 0; | 155 const base::Closure& callback) = 0; |
| 148 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; | 156 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; |
| 149 | 157 |
| 150 protected: | 158 protected: |
| 151 TestInputMethodObserver(); | 159 TestInputMethodObserver(); |
| 152 }; | 160 }; |
| 153 | 161 |
| 154 } // namespace content | 162 } // namespace content |
| 155 | 163 |
| 156 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 164 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| OLD | NEW |