Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(338)

Side by Side Diff: chrome/browser/chromeos/input_method/textinput_test_helper.cc

Issue 1197243004: Replace some Tokenize calls with SplitString. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "ash/shell.h" 5 #include "ash/shell.h"
6 #include "base/strings/string_number_conversions.h" 6 #include "base/strings/string_number_conversions.h"
7 #include "base/strings/string_split.h"
7 #include "base/strings/string_util.h" 8 #include "base/strings/string_util.h"
8 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chromeos/input_method/textinput_test_helper.h" 10 #include "chrome/browser/chromeos/input_method/textinput_test_helper.h"
10 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
11 #include "chrome/test/base/interactive_test_utils.h" 12 #include "chrome/test/base/interactive_test_utils.h"
12 #include "content/public/browser/render_view_host.h" 13 #include "content/public/browser/render_view_host.h"
13 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
14 #include "content/public/test/browser_test_utils.h" 15 #include "content/public/test/browser_test_utils.h"
15 #include "ui/aura/window_event_dispatcher.h" 16 #include "ui/aura/window_event_dispatcher.h"
16 #include "ui/aura/window_tree_host.h" 17 #include "ui/aura/window_tree_host.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 while (expected_text != surrounding_text_ || 158 while (expected_text != surrounding_text_ ||
158 expected_selection != selection_range_) 159 expected_selection != selection_range_)
159 content::RunMessageLoop(); 160 content::RunMessageLoop();
160 waiting_type_ = NO_WAIT; 161 waiting_type_ = NO_WAIT;
161 } 162 }
162 163
163 // static 164 // static
164 bool TextInputTestHelper::ConvertRectFromString(const std::string& str, 165 bool TextInputTestHelper::ConvertRectFromString(const std::string& str,
165 gfx::Rect* rect) { 166 gfx::Rect* rect) {
166 DCHECK(rect); 167 DCHECK(rect);
167 std::vector<std::string> rect_piece; 168 std::vector<base::StringPiece> rect_piece = base::SplitStringPiece(
168 if (Tokenize(str, ",", &rect_piece) != 4UL) 169 str, ",", base::KEEP_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
170 if (rect_piece.size() != 4UL)
169 return false; 171 return false;
170 int x, y, width, height; 172 int x, y, width, height;
171 if (!base::StringToInt(rect_piece[0], &x)) 173 if (!base::StringToInt(rect_piece[0], &x))
172 return false; 174 return false;
173 if (!base::StringToInt(rect_piece[1], &y)) 175 if (!base::StringToInt(rect_piece[1], &y))
174 return false; 176 return false;
175 if (!base::StringToInt(rect_piece[2], &width)) 177 if (!base::StringToInt(rect_piece[2], &width))
176 return false; 178 return false;
177 if (!base::StringToInt(rect_piece[3], &height)) 179 if (!base::StringToInt(rect_piece[3], &height))
178 return false; 180 return false;
(...skipping 21 matching lines...) Expand all
200 mouse_event.y = rect.CenterPoint().y(); 202 mouse_event.y = rect.CenterPoint().y();
201 mouse_event.clickCount = 1; 203 mouse_event.clickCount = 1;
202 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 204 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
203 205
204 mouse_event.type = blink::WebInputEvent::MouseUp; 206 mouse_event.type = blink::WebInputEvent::MouseUp;
205 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event); 207 tab->GetRenderViewHost()->ForwardMouseEvent(mouse_event);
206 return true; 208 return true;
207 } 209 }
208 210
209 } // namespace chromeos 211 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698