summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 14:39:42 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-03 14:39:42 +0000
commitc9c07779224d9dd320323943a569dbf2e416a411 (patch)
treea040e1ca03410c7cb37547b16b5a0fb8bea67dde /chrome/test
parentbe1ce6a7b2fa7e9622e5b249abd5fab478b6ca05 (diff)
downloadchromium_src-c9c07779224d9dd320323943a569dbf2e416a411.zip
chromium_src-c9c07779224d9dd320323943a569dbf2e416a411.tar.gz
chromium_src-c9c07779224d9dd320323943a569dbf2e416a411.tar.bz2
Remove number conversion functions from string_util. These moved to string_number_conversions.
TEST=it compiles BUG=none Review URL: http://codereview.chromium.org/3054036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54747 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/chrome_process_util_mac.cc9
-rw-r--r--chrome/test/mini_installer_test/chrome_mini_installer.cc12
-rw-r--r--chrome/test/pyautolib/pyautolib.cc34
-rw-r--r--chrome/test/ui/ui_test_suite.cc4
4 files changed, 34 insertions, 25 deletions
diff --git a/chrome/test/chrome_process_util_mac.cc b/chrome/test/chrome_process_util_mac.cc
index d920735..21e8746 100644
--- a/chrome/test/chrome_process_util_mac.cc
+++ b/chrome/test/chrome_process_util_mac.cc
@@ -9,6 +9,7 @@
#include "base/command_line.h"
#include "base/process_util.h"
+#include "base/string_number_conversions.h"
#include "base/string_util.h"
MacChromeProcessInfoList GetRunningMacProcessInfo(
@@ -45,9 +46,11 @@ MacChromeProcessInfoList GetRunningMacProcessInfo(
SplitString(line, ' ', &values);
if (values.size() == 3) {
MacChromeProcessInfo proc_info;
- proc_info.pid = StringToInt(values[0]);
- proc_info.rsz_in_kb = StringToInt(values[1]);
- proc_info.vsz_in_kb = StringToInt(values[2]);
+ int pid;
+ base::StringToInt(values[0], &pid);
+ proc_info.pid = pid;
+ base::StringToInt(values[1], &proc_info.rsz_in_kb);
+ base::StringToInt(values[2], &proc_info.vsz_in_kb);
if (proc_info.pid && proc_info.rsz_in_kb && proc_info.vsz_in_kb)
result.push_back(proc_info);
}
diff --git a/chrome/test/mini_installer_test/chrome_mini_installer.cc b/chrome/test/mini_installer_test/chrome_mini_installer.cc
index 931fb52..3bbe078 100644
--- a/chrome/test/mini_installer_test/chrome_mini_installer.cc
+++ b/chrome/test/mini_installer_test/chrome_mini_installer.cc
@@ -9,6 +9,7 @@
#include "base/platform_thread.h"
#include "base/process_util.h"
#include "base/registry.h"
+#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "chrome/installer/util/browser_distribution.h"
#include "chrome/installer/util/google_update_constants.h"
@@ -633,10 +634,13 @@ void ChromeMiniInstaller::LaunchBrowser(const std::wstring& launch_path,
bool ChromeMiniInstaller::VerifyOverInstall(
const std::wstring& value_before_overinstall,
const std::wstring& value_after_overinstall) {
- int64 reg_key_value_before_overinstall = StringToInt64(
- value_before_overinstall);
- int64 reg_key_value_after_overinstall = StringToInt64(
- value_after_overinstall);
+ int64 reg_key_value_before_overinstall;
+ base::StringToInt64(value_before_overinstall,
+ &reg_key_value_before_overinstall);
+ int64 reg_key_value_after_overinstall;
+ base::StringToInt64(value_after_overinstall,
+ &reg_key_value_after_overinstall);
+
// Compare to see if the version is less.
printf("Reg Key value before overinstall is%ls\n",
value_before_overinstall.c_str());
diff --git a/chrome/test/pyautolib/pyautolib.cc b/chrome/test/pyautolib/pyautolib.cc
index 58ac2dd..76c32fe 100644
--- a/chrome/test/pyautolib/pyautolib.cc
+++ b/chrome/test/pyautolib/pyautolib.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/scoped_ptr.h"
+#include "base/string_number_conversions.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/test/automation/extension_proxy.h"
@@ -10,6 +11,11 @@
#include "chrome/test/pyautolib/pyautolib.h"
#include "googleurl/src/gurl.h"
+static int64 StringToId(const std::wstring& str) {
+ int64 id;
+ base::StringToInt64(WideToUTF8(str), &id);
+ return id;
+}
// PyUITestSuiteBase
PyUITestSuiteBase::PyUITestSuiteBase(int argc, char** argv)
@@ -209,28 +215,27 @@ std::string PyUITestBase::_GetBookmarksAsJSON() {
}
bool PyUITestBase::AddBookmarkGroup(std::wstring& parent_id, int index,
- std::wstring& title) {
+ std::wstring& title) {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(0); // Window doesn't matter.
EXPECT_TRUE(browser_proxy.get());
if (!browser_proxy.get())
return false;
- return browser_proxy->AddBookmarkGroup(StringToInt64(WideToUTF16(parent_id)),
- index, title);
+ return browser_proxy->AddBookmarkGroup(StringToId(parent_id), index, title);
}
bool PyUITestBase::AddBookmarkURL(std::wstring& parent_id, int index,
- std::wstring& title, std::wstring& url) {
+ std::wstring& title, std::wstring& url) {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(0); // Window doesn't matter.
EXPECT_TRUE(browser_proxy.get());
if (!browser_proxy.get())
return false;
- return browser_proxy->AddBookmarkURL(StringToInt64(WideToUTF16(parent_id)),
+ return browser_proxy->AddBookmarkURL(StringToId(parent_id),
index, title,
- GURL(WideToUTF16(url)));
+ GURL(WideToUTF8(url)));
}
bool PyUITestBase::ReparentBookmark(
@@ -241,10 +246,9 @@ bool PyUITestBase::ReparentBookmark(
if (!browser_proxy.get())
return false;
- return browser_proxy->ReparentBookmark(
- StringToInt64(WideToUTF16(id)),
- StringToInt64(WideToUTF16(new_parent_id)),
- index);
+ return browser_proxy->ReparentBookmark(StringToId(id),
+ StringToId(new_parent_id),
+ index);
}
bool PyUITestBase::SetBookmarkTitle(std::wstring& id, std::wstring& title) {
@@ -254,8 +258,7 @@ bool PyUITestBase::SetBookmarkTitle(std::wstring& id, std::wstring& title) {
if (!browser_proxy.get())
return false;
- return browser_proxy->SetBookmarkTitle(StringToInt64(WideToUTF16(id)),
- title);
+ return browser_proxy->SetBookmarkTitle(StringToId(id), title);
}
bool PyUITestBase::SetBookmarkURL(std::wstring& id, std::wstring& url) {
@@ -265,8 +268,7 @@ bool PyUITestBase::SetBookmarkURL(std::wstring& id, std::wstring& url) {
if (!browser_proxy.get())
return false;
- return browser_proxy->SetBookmarkURL(StringToInt64(WideToUTF16(id)),
- GURL(WideToUTF16(url)));
+ return browser_proxy->SetBookmarkURL(StringToId(id), GURL(WideToUTF8(url)));
}
bool PyUITestBase::RemoveBookmark(std::wstring& id) {
@@ -276,7 +278,7 @@ bool PyUITestBase::RemoveBookmark(std::wstring& id) {
if (!browser_proxy.get())
return false;
- return browser_proxy->RemoveBookmark(StringToInt64(WideToUTF16(id)));
+ return browser_proxy->RemoveBookmark(StringToId(id));
}
scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) {
@@ -284,7 +286,7 @@ scoped_refptr<BrowserProxy> PyUITestBase::GetBrowserWindow(int window_index) {
}
std::string PyUITestBase::_SendJSONRequest(int window_index,
- std::string& request) {
+ std::string& request) {
scoped_refptr<BrowserProxy> browser_proxy =
automation()->GetBrowserWindow(window_index);
EXPECT_TRUE(browser_proxy.get());
diff --git a/chrome/test/ui/ui_test_suite.cc b/chrome/test/ui/ui_test_suite.cc
index b74593d..5ba7f1f 100644
--- a/chrome/test/ui/ui_test_suite.cc
+++ b/chrome/test/ui/ui_test_suite.cc
@@ -63,12 +63,12 @@ void UITestSuite::Initialize() {
std::wstring batch_count_str =
parsed_command_line.GetSwitchValue(UITestSuite::kBatchCount);
if (!batch_count_str.empty()) {
- batch_count = StringToInt(WideToUTF16Hack(batch_count_str));
+ base::StringToInt(WideToUTF16Hack(batch_count_str), &batch_count);
}
std::wstring batch_index_str =
parsed_command_line.GetSwitchValue(UITestSuite::kBatchIndex);
if (!batch_index_str.empty()) {
- batch_index = StringToInt(WideToUTF16Hack(batch_index_str));
+ base::StringToInt(WideToUTF16Hack(batch_index_str), &batch_index);
}
if (batch_count > 0 && batch_index >= 0 && batch_index < batch_count) {
// Running UI test in parallel. Gtest supports running tests in shards,