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 "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" | 5 #include "content/browser/renderer_host/input/touch_selection_controller_client_
aura.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 void StartTestWithPage(const std::string& url) { | 128 void StartTestWithPage(const std::string& url) { |
129 ASSERT_TRUE(embedded_test_server()->Start()); | 129 ASSERT_TRUE(embedded_test_server()->Start()); |
130 GURL test_url(embedded_test_server()->GetURL(url)); | 130 GURL test_url(embedded_test_server()->GetURL(url)); |
131 NavigateToURL(shell(), test_url); | 131 NavigateToURL(shell(), test_url); |
132 aura::Window* content = shell()->web_contents()->GetContentNativeView(); | 132 aura::Window* content = shell()->web_contents()->GetContentNativeView(); |
133 content->GetHost()->SetBounds(gfx::Rect(800, 600)); | 133 content->GetHost()->SetBounds(gfx::Rect(800, 600)); |
134 } | 134 } |
135 | 135 |
136 bool GetPointInsideText(gfx::PointF* point) { | 136 bool GetPointInsideText(gfx::PointF* point) { |
137 std::string str; | 137 std::string str; |
138 if (ExecuteScriptAndExtractString(shell()->web_contents()->GetMainFrame(), | 138 if (ExecuteScriptAndExtractString(shell(), "get_point_inside_text()", |
139 "get_point_inside_text()", &str)) { | 139 &str)) { |
140 return JSONToPoint(str, point); | 140 return JSONToPoint(str, point); |
141 } | 141 } |
142 return false; | 142 return false; |
143 } | 143 } |
144 | 144 |
145 bool GetPointInsideTextfield(gfx::PointF* point) { | 145 bool GetPointInsideTextfield(gfx::PointF* point) { |
146 std::string str; | 146 std::string str; |
147 if (ExecuteScriptAndExtractString(shell()->web_contents()->GetMainFrame(), | 147 if (ExecuteScriptAndExtractString(shell(), "get_point_inside_textfield()", |
148 "get_point_inside_textfield()", &str)) { | 148 &str)) { |
149 return JSONToPoint(str, point); | 149 return JSONToPoint(str, point); |
150 } | 150 } |
151 return false; | 151 return false; |
152 } | 152 } |
153 | 153 |
154 bool EmptyTextfield() { | 154 bool EmptyTextfield() { return ExecuteScript(shell(), "empty_textfield()"); } |
155 return ExecuteScript(shell()->web_contents()->GetMainFrame(), | |
156 "empty_textfield()"); | |
157 } | |
158 | 155 |
159 RenderWidgetHostViewAura* GetRenderWidgetHostViewAura() { | 156 RenderWidgetHostViewAura* GetRenderWidgetHostViewAura() { |
160 return static_cast<RenderWidgetHostViewAura*>( | 157 return static_cast<RenderWidgetHostViewAura*>( |
161 shell()->web_contents()->GetRenderWidgetHostView()); | 158 shell()->web_contents()->GetRenderWidgetHostView()); |
162 } | 159 } |
163 | 160 |
164 TestTouchSelectionControllerClientAura* selection_controller_client() { | 161 TestTouchSelectionControllerClientAura* selection_controller_client() { |
165 return selection_controller_client_; | 162 return selection_controller_client_; |
166 } | 163 } |
167 | 164 |
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 | 674 |
678 // The handle should have moved to right. | 675 // The handle should have moved to right. |
679 EXPECT_EQ(initial_handle_rect.y(), moved_handle_rect.y()); | 676 EXPECT_EQ(initial_handle_rect.y(), moved_handle_rect.y()); |
680 EXPECT_LT(initial_handle_rect.x(), moved_handle_rect.x()); | 677 EXPECT_LT(initial_handle_rect.x(), moved_handle_rect.x()); |
681 | 678 |
682 EXPECT_EQ(ui::TouchSelectionController::INSERTION_ACTIVE, | 679 EXPECT_EQ(ui::TouchSelectionController::INSERTION_ACTIVE, |
683 rwhva->selection_controller()->active_status()); | 680 rwhva->selection_controller()->active_status()); |
684 } | 681 } |
685 | 682 |
686 } // namespace content | 683 } // namespace content |
OLD | NEW |