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

Side by Side Diff: chrome/test/automation/tab_proxy.cc

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/automation/proxy_launcher.cc ('k') | chrome/test/chromedriver/chrome_finder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/test/automation/tab_proxy.h" 5 #include "chrome/test/automation/tab_proxy.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/json/json_string_value_serializer.h" 9 #include "base/json/json_string_value_serializer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 int TabProxy::FindInPage(const std::wstring& search_string, 55 int TabProxy::FindInPage(const std::wstring& search_string,
56 FindInPageDirection forward, 56 FindInPageDirection forward,
57 FindInPageCase match_case, 57 FindInPageCase match_case,
58 bool find_next, 58 bool find_next,
59 int* ordinal) { 59 int* ordinal) {
60 if (!is_valid()) 60 if (!is_valid())
61 return -1; 61 return -1;
62 62
63 AutomationMsg_Find_Params params; 63 AutomationMsg_Find_Params params;
64 params.search_string = WideToUTF16Hack(search_string); 64 params.search_string = base::WideToUTF16Hack(search_string);
65 params.find_next = find_next; 65 params.find_next = find_next;
66 params.match_case = (match_case == CASE_SENSITIVE); 66 params.match_case = (match_case == CASE_SENSITIVE);
67 params.forward = (forward == FWD); 67 params.forward = (forward == FWD);
68 68
69 int matches = 0; 69 int matches = 0;
70 int ordinal2 = 0; 70 int ordinal2 = 0;
71 bool succeeded = sender_->Send(new AutomationMsg_Find(handle_, 71 bool succeeded = sender_->Send(new AutomationMsg_Find(handle_,
72 params, 72 params,
73 &ordinal2, 73 &ordinal2,
74 &matches)); 74 &matches));
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 return false; 175 return false;
176 176
177 DCHECK(root->IsType(Value::TYPE_LIST)); 177 DCHECK(root->IsType(Value::TYPE_LIST));
178 Value* value = NULL; 178 Value* value = NULL;
179 bool succeeded = static_cast<ListValue*>(root.get())->Get(0, &value); 179 bool succeeded = static_cast<ListValue*>(root.get())->Get(0, &value);
180 if (succeeded) { 180 if (succeeded) {
181 string16 read_value; 181 string16 read_value;
182 succeeded = value->GetAsString(&read_value); 182 succeeded = value->GetAsString(&read_value);
183 if (succeeded) { 183 if (succeeded) {
184 // TODO(viettrungluu): remove conversion. (But should |jscript| be UTF-8?) 184 // TODO(viettrungluu): remove conversion. (But should |jscript| be UTF-8?)
185 *string_value = UTF16ToWideHack(read_value); 185 *string_value = base::UTF16ToWideHack(read_value);
186 } 186 }
187 } 187 }
188 return succeeded; 188 return succeeded;
189 } 189 }
190 190
191 bool TabProxy::ExecuteAndExtractBool(const std::wstring& frame_xpath, 191 bool TabProxy::ExecuteAndExtractBool(const std::wstring& frame_xpath,
192 const std::wstring& jscript, 192 const std::wstring& jscript,
193 bool* bool_value) { 193 bool* bool_value) {
194 scoped_ptr<Value> root(ExecuteAndExtractValue(frame_xpath, jscript)); 194 scoped_ptr<Value> root(ExecuteAndExtractValue(frame_xpath, jscript));
195 if (root == NULL) 195 if (root == NULL)
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 477
478 TabProxy::~TabProxy() {} 478 TabProxy::~TabProxy() {}
479 479
480 void TabProxy::FirstObjectAdded() { 480 void TabProxy::FirstObjectAdded() {
481 AddRef(); 481 AddRef();
482 } 482 }
483 483
484 void TabProxy::LastObjectRemoved() { 484 void TabProxy::LastObjectRemoved() {
485 Release(); 485 Release();
486 } 486 }
OLDNEW
« no previous file with comments | « chrome/test/automation/proxy_launcher.cc ('k') | chrome/test/chromedriver/chrome_finder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698