summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authormark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-29 22:18:01 +0000
committermark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2008-09-29 22:18:01 +0000
commit05f9b688e319fcb092be0e06f7b72d39dd3113b3 (patch)
tree6d24be7f9b788bbebbff6b2349e51dec49034ce6 /chrome
parent86ec30d6710923cf1c193eb88b1e6251f831e0ef (diff)
downloadchromium_src-05f9b688e319fcb092be0e06f7b72d39dd3113b3.zip
chromium_src-05f9b688e319fcb092be0e06f7b72d39dd3113b3.tar.gz
chromium_src-05f9b688e319fcb092be0e06f7b72d39dd3113b3.tar.bz2
Refactoring for portability:
- Move chrome/common/env_util to base/sys_info - Move chrome/common/rand_util to base/rand_util (new), simplify its public interface, and fix its implementation Patch by Paweł Hajdan, Jr. <phajdan.jr@gmail.com> http://codereview.chromium.org/4079 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/browser_main.cc1
-rw-r--r--chrome/browser/cache_manager_host.cc1
-rw-r--r--chrome/browser/importer/importer_unittest.cc5
-rw-r--r--chrome/browser/metrics_log.cc11
-rw-r--r--chrome/browser/render_process_host.cc4
-rw-r--r--chrome/browser/render_process_host.h5
-rw-r--r--chrome/browser/safe_browsing/bloom_filter_unittest.cc6
-rw-r--r--chrome/browser/safe_browsing/protocol_manager.cc14
-rw-r--r--chrome/browser/views/bug_report_view.cc2
-rw-r--r--chrome/common/SConscript2
-rw-r--r--chrome/common/common.vcproj16
-rw-r--r--chrome/common/env_util.cc46
-rw-r--r--chrome/common/env_util.h40
-rw-r--r--chrome/common/logging_chrome.cc4
-rw-r--r--chrome/common/process_watcher.cc8
-rw-r--r--chrome/common/rand_util.cc29
-rw-r--r--chrome/common/rand_util.h24
-rw-r--r--chrome/renderer/renderer_main.cc1
-rw-r--r--chrome/test/automated_ui_tests/automated_ui_tests.cc14
-rw-r--r--chrome/test/selenium/selenium_test.cc4
20 files changed, 37 insertions, 200 deletions
diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc
index fbb216a9..3cb98f1 100644
--- a/chrome/browser/browser_main.cc
+++ b/chrome/browser/browser_main.cc
@@ -41,7 +41,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/env_util.h"
#include "chrome/common/env_vars.h"
#include "chrome/common/jstemplate_builder.h"
#include "chrome/common/l10n_util.h"
diff --git a/chrome/browser/cache_manager_host.cc b/chrome/browser/cache_manager_host.cc
index 13fc171..be6faf3 100644
--- a/chrome/browser/cache_manager_host.cc
+++ b/chrome/browser/cache_manager_host.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/render_process_host.h"
#include "chrome/common/chrome_constants.h"
-#include "chrome/common/env_util.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
#include "chrome/common/notification_service.h"
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index 3d39db1..4a0a8df 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -19,7 +19,6 @@
#include "chrome/browser/importer/importer.h"
#include "chrome/browser/profile.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/env_util.h"
#include "chrome/common/win_util.h"
class ImporterTest : public testing::Test {
@@ -274,10 +273,6 @@ void WritePStore(IPStore* pstore, const GUID* type, const GUID* subtype) {
}
TEST_F(ImporterTest, IEImporter) {
- // Skips in Win2000 for the running environment can not be set up.
- if (env_util::GetOperatingSystemVersion() == "5.0")
- return;
-
// Sets up a favorites folder.
win_util::ScopedCOMInitializer com_init;
std::wstring path = test_path_;
diff --git a/chrome/browser/metrics_log.cc b/chrome/browser/metrics_log.cc
index bb2c2bb..a1d8f67 100644
--- a/chrome/browser/metrics_log.cc
+++ b/chrome/browser/metrics_log.cc
@@ -12,7 +12,6 @@
#include "base/sys_info.h"
#include "chrome/browser/autocomplete/autocomplete.h"
#include "chrome/browser/browser_process.h"
-#include "chrome/common/env_util.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/pref_service.h"
@@ -447,7 +446,7 @@ void MetricsLog::RecordEnvironment(
{
OPEN_ELEMENT_FOR_SCOPE("cpu");
- WriteAttribute("arch", env_util::GetCPUArchitecture());
+ WriteAttribute("arch", base::SysInfo::CPUArchitecture());
}
{
@@ -469,19 +468,19 @@ void MetricsLog::RecordEnvironment(
{
OPEN_ELEMENT_FOR_SCOPE("os");
WriteAttribute("name",
- env_util::GetOperatingSystemName());
+ base::SysInfo::OperatingSystemName());
WriteAttribute("version",
- env_util::GetOperatingSystemVersion());
+ base::SysInfo::OperatingSystemVersion());
}
{
OPEN_ELEMENT_FOR_SCOPE("display");
int width = 0;
int height = 0;
- env_util::GetPrimaryDisplayDimensions(&width, &height);
+ base::SysInfo::GetPrimaryDisplayDimensions(&width, &height);
WriteIntAttribute("xsize", width);
WriteIntAttribute("ysize", height);
- WriteIntAttribute("screens", env_util::GetDisplayCount());
+ WriteIntAttribute("screens", base::SysInfo::DisplayCount());
}
{
diff --git a/chrome/browser/render_process_host.cc b/chrome/browser/render_process_host.cc
index a1244ed..ed969a6 100644
--- a/chrome/browser/render_process_host.cc
+++ b/chrome/browser/render_process_host.cc
@@ -19,6 +19,7 @@
#include "base/logging.h"
#include "base/path_service.h"
#include "base/process_util.h"
+#include "base/rand_util.h"
#include "base/shared_event.h"
#include "base/shared_memory.h"
#include "base/string_util.h"
@@ -43,7 +44,6 @@
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/debug_flags.h"
-#include "chrome/common/env_util.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/pref_names.h"
@@ -675,7 +675,7 @@ RenderProcessHost* RenderProcessHost::GetExistingProcessHost(Profile* profile) {
// Now pick a random suitable renderer, if we have any
if (!suitable_renderers.empty()) {
int suitable_count = static_cast<int>(suitable_renderers.size());
- int random_index = rand_util::RandInt(0, suitable_count - 1);
+ int random_index = base::RandInt(0, suitable_count - 1);
return suitable_renderers[random_index];
}
diff --git a/chrome/browser/render_process_host.h b/chrome/browser/render_process_host.h
index fd76ad7..0e6a2cc 100644
--- a/chrome/browser/render_process_host.h
+++ b/chrome/browser/render_process_host.h
@@ -5,6 +5,7 @@
#ifndef CHROME_BROWSER_RENDER_PROCESS_HOST_H_
#define CHROME_BROWSER_RENDER_PROCESS_HOST_H_
+#include <limits>
#include <set>
#include <vector>
#include <windows.h>
@@ -12,12 +13,12 @@
#include "base/id_map.h"
#include "base/object_watcher.h"
#include "base/process.h"
+#include "base/rand_util.h"
#include "base/ref_counted.h"
#include "base/scoped_handle.h"
#include "base/scoped_ptr.h"
#include "chrome/common/ipc_sync_channel.h"
#include "chrome/common/notification_service.h"
-#include "chrome/common/rand_util.h"
#include "chrome/common/render_messages.h"
class PrefService;
@@ -271,7 +272,7 @@ inline std::wstring GenerateRandomChannelID(void* instance) {
// to fail.
return StringPrintf(L"%d.%x.%d",
GetCurrentProcessId(), instance,
- rand_util::RandIntSecure(0, kint32max));
+ base::RandInt(0, std::numeric_limits<int>::max()));
}
diff --git a/chrome/browser/safe_browsing/bloom_filter_unittest.cc b/chrome/browser/safe_browsing/bloom_filter_unittest.cc
index 1612084..c0ac6cb 100644
--- a/chrome/browser/safe_browsing/bloom_filter_unittest.cc
+++ b/chrome/browser/safe_browsing/bloom_filter_unittest.cc
@@ -5,18 +5,20 @@
#include "chrome/browser/safe_browsing/bloom_filter.h"
+#include <limits.h>
+
#include <set>
#include "base/logging.h"
+#include "base/rand_util.h"
#include "base/string_util.h"
#include "base/win_util.h"
-#include "chrome/common/rand_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace {
uint32 GenHash() {
- return static_cast<uint32>(rand_util::RandIntSecure(0, kint32max));
+ return static_cast<uint32>(base::RandInt(INT_MIN, INT_MAX));
}
}
diff --git a/chrome/browser/safe_browsing/protocol_manager.cc b/chrome/browser/safe_browsing/protocol_manager.cc
index 3e3c12b..e3a91ad 100644
--- a/chrome/browser/safe_browsing/protocol_manager.cc
+++ b/chrome/browser/safe_browsing/protocol_manager.cc
@@ -7,22 +7,22 @@
#include "base/histogram.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/rand_util.h"
#include "base/string_util.h"
+#include "base/sys_info.h"
#include "base/task.h"
#include "base/timer.h"
#include "chrome/browser/profile.h"
#include "chrome/browser/safe_browsing/protocol_parser.h"
#include "chrome/browser/safe_browsing/safe_browsing_service.h"
-#include "chrome/common/env_util.h"
#include "chrome/common/env_vars.h"
-#include "chrome/common/rand_util.h"
#include "chrome/common/stl_util-inl.h"
#include "net/base/base64.h"
#include "net/base/load_flags.h"
// Maximum time, in seconds, from start up before we must issue an update query.
-static const int kSbTimerStartIntervalSec = 300;
+static const int kSbTimerStartIntervalSec = 5 * 60;
// Update URL for querying about the latest set of chunk updates.
static const char* const kSbUpdateUrl =
@@ -69,10 +69,10 @@ SafeBrowsingProtocolManager::SafeBrowsingProtocolManager(
client_key_(client_key),
wrapped_key_(wrapped_key) {
// Set the backoff multiplier fuzz to a random value between 0 and 1.
- back_off_fuzz_ = static_cast<float>(rand_util::RandInt(1, INT_MAX)) / INT_MAX;
+ back_off_fuzz_ = static_cast<float>(base::RandDouble());
// The first update must happen between 0-5 minutes of start up.
- next_update_sec_ = rand_util::RandInt(60, kSbTimerStartIntervalSec);
+ next_update_sec_ = base::RandInt(60, kSbTimerStartIntervalSec);
}
SafeBrowsingProtocolManager::~SafeBrowsingProtocolManager() {
@@ -276,7 +276,7 @@ bool SafeBrowsingProtocolManager::HandleServiceResponse(const GURL& url,
if (next_update_sec > 0) {
next_update_sec_ = next_update_sec;
} else if (update_state_ == SECOND_REQUEST) {
- next_update_sec_ = rand_util::RandInt(15, 45) * 60;
+ next_update_sec_ = base::RandInt(15 * 60, 45 * 60);
}
// We need to request a new set of keys for MAC.
@@ -372,7 +372,7 @@ bool SafeBrowsingProtocolManager::HandleServiceResponse(const GURL& url,
void SafeBrowsingProtocolManager::Initialize() {
// Don't want to hit the safe browsing servers on build/chrome bots.
- if (env_util::HasEnvironmentVariable(env_vars::kHeadless))
+ if (base::SysInfo::HasEnvVar(env_vars::kHeadless))
return;
ScheduleNextUpdate(false /* no back off */);
diff --git a/chrome/browser/views/bug_report_view.cc b/chrome/browser/views/bug_report_view.cc
index b1dfacb..77a0d31 100644
--- a/chrome/browser/views/bug_report_view.cc
+++ b/chrome/browser/views/bug_report_view.cc
@@ -330,7 +330,7 @@ void BugReportView::SetUrl(const GURL& url) {
// win_util::GetWinVersion returns WinVersion, which is just
// an enum of 2000, XP, 2003, or VISTA. Not enough detail for
// bug reports
-// env_util::GetOperatingSystemVersion returns an std::string
+// base::SysInfo::OperatingSystemVersion returns an std::string
// but doesn't include the build or service pack. That function
// is probably the right one to extend, but will require changing
// all the call sites or making it a wrapper around another util.
diff --git a/chrome/common/SConscript b/chrome/common/SConscript
index 7cc8c4d..24bf254 100644
--- a/chrome/common/SConscript
+++ b/chrome/common/SConscript
@@ -87,7 +87,6 @@ if env['PLATFORM'] == 'win32':
'clipboard_service.cc',
'common_glue.cc',
'drag_drop_types.cc',
- 'env_util.cc',
'gfx/chrome_canvas.cc',
'gfx/chrome_font.cc',
'gfx/emf.cc',
@@ -110,7 +109,6 @@ if env['PLATFORM'] == 'win32':
'plugin_messages.cc',
'pref_service.cc',
'process_watcher.cc',
- 'rand_util.cc',
'render_messages.cc',
'resource_bundle.cc',
'resource_dispatcher.cc',
diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj
index 203aa3f..771ff8c 100644
--- a/chrome/common/common.vcproj
+++ b/chrome/common/common.vcproj
@@ -422,14 +422,6 @@
>
</File>
<File
- RelativePath=".\env_util.cc"
- >
- </File>
- <File
- RelativePath=".\env_util.h"
- >
- </File>
- <File
RelativePath=".\env_vars.cc"
>
</File>
@@ -598,14 +590,6 @@
>
</File>
<File
- RelativePath=".\rand_util.cc"
- >
- </File>
- <File
- RelativePath=".\rand_util.h"
- >
- </File>
- <File
RelativePath=".\ref_counted_util.h"
>
</File>
diff --git a/chrome/common/env_util.cc b/chrome/common/env_util.cc
deleted file mode 100644
index 3af22a6..0000000
--- a/chrome/common/env_util.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/common/env_util.h"
-
-#include "base/basictypes.h"
-#include "base/logging.h"
-
-namespace env_util {
-
-std::string GetOperatingSystemName() {
- return "Windows";
-}
-
-std::string GetOperatingSystemVersion() {
- OSVERSIONINFO info = {0};
- info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&info);
-
- char result[20];
- memset(result, 0, arraysize(result));
- _snprintf_s(result, arraysize(result),
- "%lu.%lu", info.dwMajorVersion, info.dwMinorVersion);
- return std::string(result);
-}
-
-std::string GetCPUArchitecture() {
- // TODO: Make this vary when we support any other architectures.
- return "x86";
-}
-
-void GetPrimaryDisplayDimensions(int* width, int* height) {
- if (width)
- *width = GetSystemMetrics(SM_CXSCREEN);
-
- if (height)
- *height = GetSystemMetrics(SM_CYSCREEN);
-}
-
-int GetDisplayCount() {
- return GetSystemMetrics(SM_CMONITORS);
-}
-
-} // namespace env_util
-
diff --git a/chrome/common/env_util.h b/chrome/common/env_util.h
deleted file mode 100644
index bb37935..0000000
--- a/chrome/common/env_util.h
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This file defines utility functions that can report details about the
-// host operating environment.
-
-#ifndef CHROME_COMMON_ENV_UTIL_H__
-#define CHROME_COMMON_ENV_UTIL_H__
-
-#include <windows.h>
-#include <string>
-
-namespace env_util {
-
-// Test if the given environment variable is defined.
-inline bool HasEnvironmentVariable(const wchar_t* var) {
- return GetEnvironmentVariable(var, NULL, 0) != 0;
-}
-
-// Returns the name of the host operating system.
-std::string GetOperatingSystemName();
-
-// Returns the version of the host operating system.
-std::string GetOperatingSystemVersion();
-
-// Returns the CPU architecture of the system.
-std::string GetCPUArchitecture();
-
-// Returns the pixel dimensions of the primary display via the
-// width and height parameters.
-void GetPrimaryDisplayDimensions(int* width, int* height);
-
-// Return the number of displays.
-int GetDisplayCount();
-
-} // namespace env_util
-
-#endif // CHROME_COMMON_ENV_UTIL_H__
-
diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc
index 232e500..af6b647 100644
--- a/chrome/common/logging_chrome.cc
+++ b/chrome/common/logging_chrome.cc
@@ -14,9 +14,9 @@
#include "base/logging.h"
#include "base/path_service.h"
#include "base/string_util.h"
+#include "base/sys_info.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/env_util.h"
#include "chrome/common/env_vars.h"
// When true, this means that error dialogs should not be shown.
@@ -96,7 +96,7 @@ void InitChromeLogging(const CommandLine& command_line,
// headless mode to be configured either by the Environment
// Variable or by the Command Line Switch. This is for
// automated test purposes.
- if (env_util::HasEnvironmentVariable(env_vars::kHeadless) ||
+ if (base::SysInfo::HasEnvVar(env_vars::kHeadless) ||
command_line.HasSwitch(switches::kNoErrorDialogs))
SuppressDialogs();
diff --git a/chrome/common/process_watcher.cc b/chrome/common/process_watcher.cc
index b8d78bd2..c189c2d 100644
--- a/chrome/common/process_watcher.cc
+++ b/chrome/common/process_watcher.cc
@@ -6,8 +6,8 @@
#include "base/message_loop.h"
#include "base/object_watcher.h"
+#include "base/sys_info.h"
#include "chrome/app/result_codes.h"
-#include "chrome/common/env_util.h"
#include "chrome/common/env_vars.h"
// Maximum amount of time (in milliseconds) to wait for the process to exit.
@@ -48,9 +48,9 @@ class TimerExpiredTask : public Task, public base::ObjectWatcher::Delegate {
private:
void KillProcess() {
- if (env_util::HasEnvironmentVariable(env_vars::kHeadless)) {
- // If running the distributed tests, give the renderer a little time to figure out
- // that the channel is shutdown and unwind.
+ if (base::SysInfo::HasEnvVar(env_vars::kHeadless)) {
+ // If running the distributed tests, give the renderer a little time
+ // to figure out that the channel is shutdown and unwind.
if (WaitForSingleObject(process_, kWaitInterval) == WAIT_OBJECT_0) {
OnObjectSignaled(process_);
return;
diff --git a/chrome/common/rand_util.cc b/chrome/common/rand_util.cc
deleted file mode 100644
index 52492a0..0000000
--- a/chrome/common/rand_util.cc
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/common/rand_util.h"
-
-#include <stdlib.h>
-
-#include "base/logging.h"
-
-namespace rand_util {
-
-int RandInt(int min, int max) {
- return RandIntSecure(min, max);
-}
-
-int RandIntSecure(int min, int max) {
- unsigned int number;
- // This code will not work on win2k, which we do not support.
- errno_t rv = rand_s(&number);
- DCHECK(rv == 0) << "rand_s failed with error " << rv;
-
- // From the rand man page, use this instead of just rand() % max, so that the
- // higher bits are used.
- return min + static_cast<int>(static_cast<double>(max - min + 1.0) *
- (number / (UINT_MAX + 1.0)));
-}
-
-} // namespace rand_util
diff --git a/chrome/common/rand_util.h b/chrome/common/rand_util.h
deleted file mode 100644
index 08e735f..0000000
--- a/chrome/common/rand_util.h
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef CHROME_COMMON_RAND_UTIL_H__
-#define CHROME_COMMON_RAND_UTIL_H__
-
-#include "base/basictypes.h"
-
-namespace rand_util {
-
-// Returns a random number between min and max (inclusive). This is a
-// non-cryptographic random number generator, using rand() from the CRT.
-int RandInt(int min, int max);
-
-// Returns a random number between min and max (inclusive). This is a (slower)
-// cryptographic random number generator using rand_s() from the CRT. Note
-// that it does not work in Win2K, so it degrades to RandInt.
-int RandIntSecure(int min, int max);
-
-} // namespace rand_util
-
-#endif // CHROME_COMMON_RAND_UTIL_H__
-
diff --git a/chrome/renderer/renderer_main.cc b/chrome/renderer/renderer_main.cc
index d54a4bc..2553a65 100644
--- a/chrome/renderer/renderer_main.cc
+++ b/chrome/renderer/renderer_main.cc
@@ -10,7 +10,6 @@
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_counters.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/env_util.h"
#include "chrome/common/l10n_util.h"
#include "chrome/common/logging_chrome.h"
#include "chrome/common/resource_bundle.h"
diff --git a/chrome/test/automated_ui_tests/automated_ui_tests.cc b/chrome/test/automated_ui_tests/automated_ui_tests.cc
index 694ad4e..7372030 100644
--- a/chrome/test/automated_ui_tests/automated_ui_tests.cc
+++ b/chrome/test/automated_ui_tests/automated_ui_tests.cc
@@ -7,13 +7,13 @@
#include "base/command_line.h"
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/rand_util.h"
#include "base/string_util.h"
#include "chrome/app/chrome_dll_resource.h"
#include "chrome/browser/character_encoding.h"
#include "chrome/browser/view_ids.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/libxml_utils.h"
-#include "chrome/common/rand_util.h"
#include "chrome/common/win_util.h"
#include "chrome/test/automated_ui_tests/automated_ui_tests.h"
#include "chrome/test/automation/browser_proxy.h"
@@ -421,9 +421,9 @@ bool AutomatedUITest::ChangeEncoding() {
// The vector will contain mostly IDC values for encoding commands plus a few
// menu separators (0 values). If we hit a separator we just retry.
- int index = rand_util::RandInt(0, len);
+ int index = base::RandInt(0, len);
while ((*encoding_ids)[index] == 0) {
- index = rand_util::RandInt(0, len);
+ index = base::RandInt(0, len);
}
return RunCommand((*encoding_ids)[index]);
@@ -690,7 +690,7 @@ bool AutomatedUITest::TestViewPasswords() {
}
bool AutomatedUITest::ExerciseDialog() {
- int index = rand_util::RandInt(0, arraysize(kDialogs) - 1);
+ int index = base::RandInt(0, arraysize(kDialogs) - 1);
return DoAction(kDialogs[index]) && FuzzyTestDialog(kTestDialogActionsToRun);
}
@@ -703,9 +703,9 @@ bool AutomatedUITest::FuzzyTestDialog(int num_actions) {
// and Enter would close the dialog without performing more actions. We
// rely on the fact that those two actions are first in the array and set
// the lower bound to 2 if i == 0 to skip those two actions.
- int action_index = rand_util::RandInt(i == 0 ? 2 : 0,
- arraysize(kTestDialogPossibleActions)
- - 1);
+ int action_index = base::RandInt(i == 0 ? 2 : 0,
+ arraysize(kTestDialogPossibleActions)
+ - 1);
return_value = return_value &&
DoAction(kTestDialogPossibleActions[action_index]);
if (DidCrash(false))
diff --git a/chrome/test/selenium/selenium_test.cc b/chrome/test/selenium/selenium_test.cc
index 6bfc72f..a1d8a09 100644
--- a/chrome/test/selenium/selenium_test.cc
+++ b/chrome/test/selenium/selenium_test.cc
@@ -14,9 +14,9 @@
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/rand_util.h"
#include "base/string_util.h"
#include "chrome/common/chrome_paths.h"
-#include "chrome/common/rand_util.h"
#include "chrome/test/automation/tab_proxy.h"
#include "chrome/test/automation/window_proxy.h"
#include "chrome/test/ui/ui_test.h"
@@ -88,7 +88,7 @@ class SeleniumTest : public UITest {
L"5.selectFrame,6.click,13.verifyLocation,13.verifyLocation,13.click,24.selectAndWait,24.verifyTitle",
L"5.selectFrame,6.click,24.selectAndWait"
};
- *failed = kBogusFailures[rand_util::RandInt(0, 2)];
+ *failed = kBogusFailures[base::RandInt(0, 2)];
#else
std::wstring test_path;
PathService::Get(chrome::DIR_TEST_DATA, &test_path);