Chromium Code Reviews| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 44 public: | 44 public: |
| 45 using Callback = base::Callback<void(TextInputManagerTester*)>; | 45 using Callback = base::Callback<void(TextInputManagerTester*)>; |
| 46 | 46 |
| 47 TextInputManagerTester(WebContents* web_contents); | 47 TextInputManagerTester(WebContents* web_contents); |
| 48 virtual ~TextInputManagerTester(); | 48 virtual ~TextInputManagerTester(); |
| 49 | 49 |
| 50 // Sets a callback which is invoked when a RWHV calls UpdateTextInputState | 50 // Sets a callback which is invoked when a RWHV calls UpdateTextInputState |
| 51 // on the TextInputManager which is being observed. | 51 // on the TextInputManager which is being observed. |
| 52 void SetUpdateTextInputStateCalledCallback(const Callback& callback); | 52 void SetUpdateTextInputStateCalledCallback(const Callback& callback); |
| 53 | 53 |
| 54 // Sets a callback which is invoked when a RWHV calls SelectionBoundsChanged | |
| 55 // on the TextInputManager which is being observed. | |
| 56 void SetOnSelectionBoundsChangedCallback(const Callback& callback); | |
| 57 | |
| 54 // Returns true if there is a focused <input> and populates |type| with | 58 // Returns true if there is a focused <input> and populates |type| with |
| 55 // |TextInputState.type| of the TextInputManager. | 59 // |TextInputState.type| of the TextInputManager. |
| 56 bool GetTextInputType(ui::TextInputType* type); | 60 bool GetTextInputType(ui::TextInputType* type); |
| 57 | 61 |
| 58 // Returns true if there is a focused <input> and populates |value| with | 62 // Returns true if there is a focused <input> and populates |value| with |
| 59 // |TextInputState.value| of the TextInputManager. | 63 // |TextInputState.value| of the TextInputManager. |
| 60 bool GetTextInputValue(std::string* value); | 64 bool GetTextInputValue(std::string* value); |
| 61 | 65 |
| 62 // Returns the RenderWidgetHostView with a focused <input> element or nullptr | 66 // Returns the RenderWidgetHostView with a focused <input> element or nullptr |
| 63 // if none exists. | 67 // if none exists. |
| 64 const RenderWidgetHostView* GetActiveView(); | 68 const RenderWidgetHostView* GetActiveView(); |
| 65 | 69 |
| 66 // Returns the RenderWidgetHostView which has most recently called | 70 // Returns the RenderWidgetHostView which has most recently updated its state, |
| 67 // TextInputManager::UpdateTextInputState on the TextInputManager which is | 71 // i.e., selection bounds or TextInputState, with the TextInputManager that is |
|
Charlie Reis
2016/06/29 20:18:37
Are these the only things that will trigger it, or
EhsanK
2016/06/30 00:24:45
We might keep adding for similar additions:
Render
Charlie Reis
2016/06/30 20:27:21
Updating the value on any of those seems reasonabl
EhsanK
2016/06/30 21:01:14
Acknowledged.
| |
| 68 // being observed. | 72 // being observed. |
| 69 const RenderWidgetHostView* GetUpdatedView(); | 73 const RenderWidgetHostView* GetUpdatedView(); |
| 70 | 74 |
| 71 // Returns true if a call to TextInputManager::UpdateTextInputState has led | 75 // Returns true if a call to TextInputManager::UpdateTextInputState has led |
| 72 // to a change in TextInputState (since the time the observer has been | 76 // to a change in TextInputState (since the time the observer has been |
| 73 // created). | 77 // created). |
| 74 bool IsTextInputStateChanged(); | 78 bool IsTextInputStateChanged(); |
| 75 | 79 |
| 76 private: | 80 private: |
| 77 // The actual internal observer of the TextInputManager. | 81 // The actual internal observer of the TextInputManager. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 146 const base::Closure& callback) = 0; | 150 const base::Closure& callback) = 0; |
| 147 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; | 151 virtual void SetOnShowImeIfNeededCallback(const base::Closure& callback) = 0; |
| 148 | 152 |
| 149 protected: | 153 protected: |
| 150 TestInputMethodObserver(); | 154 TestInputMethodObserver(); |
| 151 }; | 155 }; |
| 152 | 156 |
| 153 } // namespace content | 157 } // namespace content |
| 154 | 158 |
| 155 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ | 159 #endif // CONTENT_PUBLIC_TEST_TEXT_INPUT_TEST_UTILS_H_ |
| OLD | NEW |