Skip to content

Commit

Permalink
Switch to standard integer types in base/test/.
Browse files Browse the repository at this point in the history
BUG=138542
TBR=phajdan.jr@chromium.org

Review URL: https://codereview.chromium.org/1544113002

Cr-Commit-Position: refs/heads/master@{#366794}
  • Loading branch information
avi authored and Commit bot committed Dec 24, 2015
1 parent 20cc449 commit d351e5a
Show file tree
Hide file tree
Showing 48 changed files with 105 additions and 40 deletions.
2 changes: 2 additions & 0 deletions base/test/gtest_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "base/test/gtest_util.h"

#include <stddef.h>

#include "base/files/file_path.h"
#include "base/json/json_file_value_serializer.h"
#include "base/values.h"
Expand Down
6 changes: 4 additions & 2 deletions base/test/gtest_xml_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "base/test/gtest_xml_util.h"

#include <stdint.h>

#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
Expand Down Expand Up @@ -118,8 +120,8 @@ bool ProcessGTestOutput(const base::FilePath& output_file,
if (!xml_reader.NodeAttribute("time", &test_time_str))
return false;
result.elapsed_time = TimeDelta::FromMicroseconds(
static_cast<int64>(strtod(test_time_str.c_str(), NULL) *
Time::kMicrosecondsPerSecond));
static_cast<int64_t>(strtod(test_time_str.c_str(), NULL) *
Time::kMicrosecondsPerSecond));

result.status = TestResult::TEST_SUCCESS;

Expand Down
2 changes: 2 additions & 0 deletions base/test/histogram_tester.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "base/test/histogram_tester.h"

#include <stddef.h>

#include "base/metrics/histogram.h"
#include "base/metrics/histogram_samples.h"
#include "base/metrics/metrics_hashes.h"
Expand Down
2 changes: 1 addition & 1 deletion base/test/histogram_tester.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <utility>
#include <vector>

#include "base/basictypes.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/metrics/histogram.h"
#include "base/metrics/histogram_base.h"
Expand Down
14 changes: 8 additions & 6 deletions base/test/launcher/test_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

#include "base/test/launcher/test_launcher.h"

#if defined(OS_POSIX)
#include <fcntl.h>
#endif

#include "base/at_exit.h"
#include "base/bind.h"
#include "base/command_line.h"
Expand All @@ -20,6 +16,7 @@
#include "base/lazy_instance.h"
#include "base/location.h"
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
#include "base/process/kill.h"
Expand All @@ -40,8 +37,13 @@
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"

#if defined(OS_POSIX)
#include <fcntl.h>
#endif

#if defined(OS_MACOSX)
#include "base/mac/scoped_nsautorelease_pool.h"
#endif
Expand Down Expand Up @@ -167,7 +169,7 @@ class SignalFDWatcher : public MessageLoopForIO::Watcher {
// Parses the environment variable var as an Int32. If it is unset, returns
// true. If it is set, unsets it then converts it to Int32 before
// returning it in |result|. Returns true on success.
bool TakeInt32FromEnvironment(const char* const var, int32* result) {
bool TakeInt32FromEnvironment(const char* const var, int32_t* result) {
scoped_ptr<Environment> env(Environment::Create());
std::string str_val;

Expand Down Expand Up @@ -951,7 +953,7 @@ void TestLauncher::RunTests() {
if (excluded)
continue;

if (Hash(test_name) % total_shards_ != static_cast<uint32>(shard_index_))
if (Hash(test_name) % total_shards_ != static_cast<uint32_t>(shard_index_))
continue;

test_names.push_back(test_name);
Expand Down
9 changes: 6 additions & 3 deletions base/test/launcher/test_launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@
#ifndef BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_
#define BASE_TEST_LAUNCHER_TEST_LAUNCHER_H_

#include <stddef.h>
#include <stdint.h>

#include <set>
#include <string>

#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/test/gtest_util.h"
#include "base/test/launcher/test_result.h"
#include "base/test/launcher/test_results_tracker.h"
Expand Down Expand Up @@ -151,8 +154,8 @@ class TestLauncher {
TestLauncherDelegate* launcher_delegate_;

// Support for outer sharding, just like gtest does.
int32 total_shards_; // Total number of outer shards, at least one.
int32 shard_index_; // Index of shard the launcher is to run.
int32_t total_shards_; // Total number of outer shards, at least one.
int32_t shard_index_; // Index of shard the launcher is to run.

int cycles_; // Number of remaining test itreations, or -1 for infinite.

Expand Down
1 change: 1 addition & 0 deletions base/test/launcher/test_launcher_ios.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_temp_dir.h"
#include "base/format_macros.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/process/launch.h"
Expand Down
2 changes: 2 additions & 0 deletions base/test/launcher/test_result.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "base/test/launcher/test_result.h"

#include <stddef.h>

#include "base/logging.h"

namespace base {
Expand Down
2 changes: 2 additions & 0 deletions base/test/launcher/test_results_tracker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "base/test/launcher/test_results_tracker.h"

#include <stddef.h>

#include <utility>

#include "base/base64.h"
Expand Down
1 change: 1 addition & 0 deletions base/test/launcher/test_results_tracker.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <vector>

#include "base/callback.h"
#include "base/macros.h"
#include "base/test/launcher/test_result.h"
#include "base/threading/thread_checker.h"

Expand Down
2 changes: 2 additions & 0 deletions base/test/launcher/unit_test_launcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "base/files/scoped_temp_dir.h"
#include "base/format_macros.h"
#include "base/location.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
Expand All @@ -27,6 +28,7 @@
#include "base/third_party/dynamic_annotations/dynamic_annotations.h"
#include "base/thread_task_runner_handle.h"
#include "base/threading/thread_checker.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
Expand Down
4 changes: 4 additions & 0 deletions base/test/launcher/unit_test_launcher.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@
#ifndef BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_
#define BASE_TEST_LAUNCHER_UNIT_TEST_LAUNCHER_H_

#include <stddef.h>

#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/test/launcher/test_launcher.h"
#include "build/build_config.h"

namespace base {

Expand Down
2 changes: 1 addition & 1 deletion base/test/malloc_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef BASE_TEST_MALLOC_WRAPPER_H_
#define BASE_TEST_MALLOC_WRAPPER_H_

#include "base/basictypes.h"
#include <stddef.h>

// BASE_EXPORT depends on COMPONENT_BUILD.
// This will always be a separate shared library, so don't use BASE_EXPORT here.
Expand Down
1 change: 1 addition & 0 deletions base/test/mock_devices_changed_observer.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#include <string>

#include "base/macros.h"
#include "base/system_monitor/system_monitor.h"
#include "testing/gmock/include/gmock/gmock.h"

Expand Down
3 changes: 2 additions & 1 deletion base/test/mock_entropy_provider.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ namespace base {
MockEntropyProvider::~MockEntropyProvider() {}

double MockEntropyProvider::GetEntropyForTrial(
const std::string& trial_name, uint32 randomization_seed) const {
const std::string& trial_name,
uint32_t randomization_seed) const {
return 0.5;
}

Expand Down
4 changes: 3 additions & 1 deletion base/test/mock_entropy_provider.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BASE_TEST_MOCK_ENTROPY_PROVIDER_H_
#define BASE_TEST_MOCK_ENTROPY_PROVIDER_H_

#include <stdint.h>

#include "base/metrics/field_trial.h"

namespace base {
Expand All @@ -15,7 +17,7 @@ class MockEntropyProvider : public base::FieldTrial::EntropyProvider {

// base::FieldTrial::EntropyProvider:
double GetEntropyForTrial(const std::string& trial_name,
uint32 randomization_seed) const override;
uint32_t randomization_seed) const override;
};

} // namespace base
Expand Down
2 changes: 2 additions & 0 deletions base/test/mock_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#ifndef BASE_TEST_MOCK_LOG_H_
#define BASE_TEST_MOCK_LOG_H_

#include <stddef.h>

#include <string>

#include "base/logging.h"
Expand Down
1 change: 1 addition & 0 deletions base/test/multiprocess_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "build/build_config.h"

namespace base {

Expand Down
2 changes: 1 addition & 1 deletion base/test/multiprocess_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <string>

#include "base/basictypes.h"
#include "base/macros.h"
#include "base/process/launch.h"
#include "base/process/process.h"
#include "build/build_config.h"
Expand Down
2 changes: 1 addition & 1 deletion base/test/null_task_runner.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef BASE_TEST_NULL_TASK_RUNNER_H_
#define BASE_TEST_NULL_TASK_RUNNER_H_

#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/single_thread_task_runner.h"

namespace base {
Expand Down
1 change: 1 addition & 0 deletions base/test/perf_test_suite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include "base/process/launch.h"
#include "base/strings/string_util.h"
#include "base/test/perf_log.h"
#include "build/build_config.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace base {
Expand Down
2 changes: 1 addition & 1 deletion base/test/perf_time_logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <string>

#include "base/basictypes.h"
#include "base/macros.h"
#include "base/timer/elapsed_timer.h"

namespace base {
Expand Down
1 change: 1 addition & 0 deletions base/test/run_all_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include "base/bind.h"
#include "base/test/launcher/unit_test_launcher.h"
#include "base/test/test_suite.h"
#include "build/build_config.h"

#if defined(OS_ANDROID)
#include "base/android/jni_android.h"
Expand Down
2 changes: 1 addition & 1 deletion base/test/scoped_locale.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

#include <string>

#include "base/basictypes.h"
#include "base/macros.h"

namespace base {

Expand Down
2 changes: 1 addition & 1 deletion base/test/scoped_path_override.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
#ifndef BASE_TEST_SCOPED_PATH_OVERRIDE_H_
#define BASE_TEST_SCOPED_PATH_OVERRIDE_H_

#include "base/basictypes.h"
#include "base/files/scoped_temp_dir.h"
#include "base/macros.h"

namespace base {

Expand Down
2 changes: 1 addition & 1 deletion base/test/sequenced_task_runner_test_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
#include <iosfwd>
#include <vector>

#include "base/basictypes.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/sequenced_task_runner.h"
#include "base/synchronization/condition_variable.h"
Expand Down
4 changes: 3 additions & 1 deletion base/test/sequenced_worker_pool_owner.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@
#ifndef BASE_TEST_SEQUENCED_WORKER_POOL_OWNER_H_
#define BASE_TEST_SEQUENCED_WORKER_POOL_OWNER_H_

#include <stddef.h>

#include <cstddef>
#include <string>

#include "base/basictypes.h"
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
#include "base/synchronization/lock.h"
Expand Down
2 changes: 1 addition & 1 deletion base/test/task_runner_test_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@
#include <cstddef>
#include <map>

#include "base/basictypes.h"
#include "base/bind.h"
#include "base/callback.h"
#include "base/location.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/single_thread_task_runner.h"
#include "base/synchronization/condition_variable.h"
Expand Down
3 changes: 3 additions & 0 deletions base/test/test_discardable_memory_allocator.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
#ifndef BASE_TEST_TEST_DISCARDABLE_MEMORY_ALLOCATOR_H_
#define BASE_TEST_TEST_DISCARDABLE_MEMORY_ALLOCATOR_H_

#include <stddef.h>

#include "base/macros.h"
#include "base/memory/discardable_memory_allocator.h"

namespace base {
Expand Down
5 changes: 4 additions & 1 deletion base/test/test_file_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,17 @@

// File utility functions used only by tests.

#include <stddef.h>

#include <string>

#include "base/compiler_specific.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "build/build_config.h"

#if defined(OS_ANDROID)
#include <jni.h>
#include "base/basictypes.h"
#endif

namespace base {
Expand Down
Loading

0 comments on commit d351e5a

Please sign in to comment.