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

Unified Diff: util/misc/random_string.cc

Issue 1451793002: Add RandomString() and its test, and use it everywhere it makes sense (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: Fix tpyo Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « util/misc/random_string.h ('k') | util/misc/random_string_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/misc/random_string.cc
diff --git a/snapshot/mac/mach_o_image_annotations_reader_test_module_crashy_initializer.cc b/util/misc/random_string.cc
similarity index 71%
copy from snapshot/mac/mach_o_image_annotations_reader_test_module_crashy_initializer.cc
copy to util/misc/random_string.cc
index 2ba9bee043af4a606c8d6c90bb8a2b73b5867edb..a522799ad1611b67e86ae4dc33e7904867bd778c 100644
--- a/snapshot/mac/mach_o_image_annotations_reader_test_module_crashy_initializer.cc
+++ b/util/misc/random_string.cc
@@ -12,20 +12,18 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+#include "util/misc/random_string.h"
+
+#include "base/rand_util.h"
+
namespace crashpad {
-namespace test {
-namespace {
-class CrashyClass {
- public:
- CrashyClass() {
- __builtin_trap();
+std::string RandomString() {
+ std::string random_string;
+ for (int index = 0; index < 16; ++index) {
+ random_string.append(1, static_cast<char>(base::RandInt('A', 'Z')));
}
-};
-
-// __attribute__((used)) keeps the dead code stripper away.
-__attribute__((used)) CrashyClass g_crashy_object;
+ return random_string;
+}
-} // namespace
-} // namespace test
} // namespace crashpad
« no previous file with comments | « util/misc/random_string.h ('k') | util/misc/random_string_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698