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

Side by Side Diff: base/test/launcher/test_launcher.cc

Issue 1544113002: Switch to standard integer types in base/test/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « base/test/launcher/test_launcher.h ('k') | base/test/launcher/test_launcher_ios.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/test/launcher/test_launcher.h" 5 #include "base/test/launcher/test_launcher.h"
6 6
7 #if defined(OS_POSIX)
8 #include <fcntl.h>
9 #endif
10
11 #include "base/at_exit.h" 7 #include "base/at_exit.h"
12 #include "base/bind.h" 8 #include "base/bind.h"
13 #include "base/command_line.h" 9 #include "base/command_line.h"
14 #include "base/environment.h" 10 #include "base/environment.h"
15 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
16 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
17 #include "base/files/scoped_file.h" 13 #include "base/files/scoped_file.h"
18 #include "base/format_macros.h" 14 #include "base/format_macros.h"
19 #include "base/hash.h" 15 #include "base/hash.h"
20 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
21 #include "base/location.h" 17 #include "base/location.h"
22 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/macros.h"
23 #include "base/memory/scoped_ptr.h" 20 #include "base/memory/scoped_ptr.h"
24 #include "base/message_loop/message_loop.h" 21 #include "base/message_loop/message_loop.h"
25 #include "base/process/kill.h" 22 #include "base/process/kill.h"
26 #include "base/process/launch.h" 23 #include "base/process/launch.h"
27 #include "base/single_thread_task_runner.h" 24 #include "base/single_thread_task_runner.h"
28 #include "base/strings/pattern.h" 25 #include "base/strings/pattern.h"
29 #include "base/strings/string_number_conversions.h" 26 #include "base/strings/string_number_conversions.h"
30 #include "base/strings/string_split.h" 27 #include "base/strings/string_split.h"
31 #include "base/strings/string_util.h" 28 #include "base/strings/string_util.h"
32 #include "base/strings/stringize_macros.h" 29 #include "base/strings/stringize_macros.h"
33 #include "base/strings/stringprintf.h" 30 #include "base/strings/stringprintf.h"
34 #include "base/strings/utf_string_conversions.h" 31 #include "base/strings/utf_string_conversions.h"
35 #include "base/test/gtest_util.h" 32 #include "base/test/gtest_util.h"
36 #include "base/test/launcher/test_results_tracker.h" 33 #include "base/test/launcher/test_results_tracker.h"
37 #include "base/test/sequenced_worker_pool_owner.h" 34 #include "base/test/sequenced_worker_pool_owner.h"
38 #include "base/test/test_switches.h" 35 #include "base/test/test_switches.h"
39 #include "base/test/test_timeouts.h" 36 #include "base/test/test_timeouts.h"
40 #include "base/thread_task_runner_handle.h" 37 #include "base/thread_task_runner_handle.h"
41 #include "base/threading/thread_checker.h" 38 #include "base/threading/thread_checker.h"
42 #include "base/time/time.h" 39 #include "base/time/time.h"
40 #include "build/build_config.h"
43 #include "testing/gtest/include/gtest/gtest.h" 41 #include "testing/gtest/include/gtest/gtest.h"
44 42
43 #if defined(OS_POSIX)
44 #include <fcntl.h>
45 #endif
46
45 #if defined(OS_MACOSX) 47 #if defined(OS_MACOSX)
46 #include "base/mac/scoped_nsautorelease_pool.h" 48 #include "base/mac/scoped_nsautorelease_pool.h"
47 #endif 49 #endif
48 50
49 #if defined(OS_WIN) 51 #if defined(OS_WIN)
50 #include "base/win/windows_version.h" 52 #include "base/win/windows_version.h"
51 #endif 53 #endif
52 54
53 namespace base { 55 namespace base {
54 56
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 void OnFileCanWriteWithoutBlocking(int fd) override { NOTREACHED(); } 162 void OnFileCanWriteWithoutBlocking(int fd) override { NOTREACHED(); }
161 163
162 private: 164 private:
163 DISALLOW_COPY_AND_ASSIGN(SignalFDWatcher); 165 DISALLOW_COPY_AND_ASSIGN(SignalFDWatcher);
164 }; 166 };
165 #endif // defined(OS_POSIX) 167 #endif // defined(OS_POSIX)
166 168
167 // Parses the environment variable var as an Int32. If it is unset, returns 169 // Parses the environment variable var as an Int32. If it is unset, returns
168 // true. If it is set, unsets it then converts it to Int32 before 170 // true. If it is set, unsets it then converts it to Int32 before
169 // returning it in |result|. Returns true on success. 171 // returning it in |result|. Returns true on success.
170 bool TakeInt32FromEnvironment(const char* const var, int32* result) { 172 bool TakeInt32FromEnvironment(const char* const var, int32_t* result) {
171 scoped_ptr<Environment> env(Environment::Create()); 173 scoped_ptr<Environment> env(Environment::Create());
172 std::string str_val; 174 std::string str_val;
173 175
174 if (!env->GetVar(var, &str_val)) 176 if (!env->GetVar(var, &str_val))
175 return true; 177 return true;
176 178
177 if (!env->UnSetVar(var)) { 179 if (!env->UnSetVar(var)) {
178 LOG(ERROR) << "Invalid environment: we could not unset " << var << ".\n"; 180 LOG(ERROR) << "Invalid environment: we could not unset " << var << ".\n";
179 return false; 181 return false;
180 } 182 }
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
944 bool excluded = false; 946 bool excluded = false;
945 for (size_t k = 0; k < negative_test_filter_.size(); ++k) { 947 for (size_t k = 0; k < negative_test_filter_.size(); ++k) {
946 if (MatchPattern(test_name, negative_test_filter_[k])) { 948 if (MatchPattern(test_name, negative_test_filter_[k])) {
947 excluded = true; 949 excluded = true;
948 break; 950 break;
949 } 951 }
950 } 952 }
951 if (excluded) 953 if (excluded)
952 continue; 954 continue;
953 955
954 if (Hash(test_name) % total_shards_ != static_cast<uint32>(shard_index_)) 956 if (Hash(test_name) % total_shards_ != static_cast<uint32_t>(shard_index_))
955 continue; 957 continue;
956 958
957 test_names.push_back(test_name); 959 test_names.push_back(test_name);
958 } 960 }
959 961
960 test_started_count_ = launcher_delegate_->RunTests(this, test_names); 962 test_started_count_ = launcher_delegate_->RunTests(this, test_names);
961 963
962 if (test_started_count_ == 0) { 964 if (test_started_count_ == 0) {
963 fprintf(stdout, "0 tests run\n"); 965 fprintf(stdout, "0 tests run\n");
964 fflush(stdout); 966 fflush(stdout);
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 } 1092 }
1091 1093
1092 std::string snippet(full_output.substr(run_pos)); 1094 std::string snippet(full_output.substr(run_pos));
1093 if (end_pos != std::string::npos) 1095 if (end_pos != std::string::npos)
1094 snippet = full_output.substr(run_pos, end_pos - run_pos); 1096 snippet = full_output.substr(run_pos, end_pos - run_pos);
1095 1097
1096 return snippet; 1098 return snippet;
1097 } 1099 }
1098 1100
1099 } // namespace base 1101 } // namespace base
OLDNEW
« no previous file with comments | « base/test/launcher/test_launcher.h ('k') | base/test/launcher/test_launcher_ios.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698