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

Unified Diff: base/debug/crash_logging_unittest.cc

Issue 12211080: Change crash keys to be registered with a maximum length instead of number of chunks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Win fix Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: base/debug/crash_logging_unittest.cc
diff --git a/base/debug/crash_logging_unittest.cc b/base/debug/crash_logging_unittest.cc
index c26566ae3e86dedbb5554f10de7bbf6be9696529..daa2a9259a12cf9e2bd0b28cb5a6d1028cef2477 100644
--- a/base/debug/crash_logging_unittest.cc
+++ b/base/debug/crash_logging_unittest.cc
@@ -45,7 +45,7 @@ class CrashLoggingTest : public testing::Test {
TEST_F(CrashLoggingTest, SetClearSingle) {
const char* kTestKey = "test-key";
- base::debug::CrashKey keys[] = { { kTestKey, 1 } };
+ base::debug::CrashKey keys[] = { { kTestKey, 255 } };
base::debug::InitCrashKeys(keys, arraysize(keys), 255);
base::debug::SetCrashKeyValue(kTestKey, "value");
@@ -60,7 +60,7 @@ TEST_F(CrashLoggingTest, SetChunked) {
const char* kChunk1 = "chunky-1";
const char* kChunk2 = "chunky-2";
const char* kChunk3 = "chunky-3";
- base::debug::CrashKey keys[] = { { kTestKey, 3 } };
+ base::debug::CrashKey keys[] = { { kTestKey, 15 } };
base::debug::InitCrashKeys(keys, arraysize(keys), 5);
std::map<std::string, std::string>& values = *key_values_;
@@ -72,7 +72,7 @@ TEST_F(CrashLoggingTest, SetChunked) {
EXPECT_TRUE(values.end() == values.find(kChunk2));
EXPECT_TRUE(values.end() == values.find(kChunk3));
- // Fill all three chunks with truncation.
+ // Fill three chunks with truncation (max length is 15, this string is 20).
base::debug::SetCrashKeyValue(kTestKey, "five four three two");
EXPECT_EQ(3u, values.size());
EXPECT_EQ("five ", values[kChunk1]);
@@ -105,7 +105,7 @@ TEST_F(CrashLoggingTest, SetChunked) {
TEST_F(CrashLoggingTest, ScopedCrashKey) {
const char* kTestKey = "test-key";
- base::debug::CrashKey keys[] = { { kTestKey, 1 } };
+ base::debug::CrashKey keys[] = { { kTestKey, 255 } };
base::debug::InitCrashKeys(keys, arraysize(keys), 255);
EXPECT_EQ(0u, key_values_->size());
@@ -121,12 +121,12 @@ TEST_F(CrashLoggingTest, ScopedCrashKey) {
TEST_F(CrashLoggingTest, InitSize) {
base::debug::CrashKey keys[] = {
- { "chunked-3", 3 },
- { "single", 1 },
- { "chunked-6", 6 },
+ { "chunked-3", 15 },
+ { "single", 5 },
+ { "chunked-6", 30 },
};
- size_t num_keys = base::debug::InitCrashKeys(keys, arraysize(keys), 255);
+ size_t num_keys = base::debug::InitCrashKeys(keys, arraysize(keys), 5);
EXPECT_EQ(10u, num_keys);
@@ -140,9 +140,9 @@ TEST_F(CrashLoggingTest, ChunkValue) {
using base::debug::ChunkCrashKeyValue;
// Test truncation.
- base::debug::CrashKey key = { "chunky", 1 };
+ base::debug::CrashKey key = { "chunky", 10 };
std::vector<std::string> results =
- ChunkCrashKeyValue(key, "hello world", 10);
+ ChunkCrashKeyValue(key, "hello world", 64);
ASSERT_EQ(1u, results.size());
EXPECT_EQ("hello worl", results[0]);
@@ -152,7 +152,7 @@ TEST_F(CrashLoggingTest, ChunkValue) {
EXPECT_EQ("hi", results[0]);
// Test chunk pair.
- key.num_chunks = 2;
+ key.max_length = 6;
results = ChunkCrashKeyValue(key, "foobar", 3);
ASSERT_EQ(2u, results.size());
EXPECT_EQ("foo", results[0]);
@@ -165,7 +165,7 @@ TEST_F(CrashLoggingTest, ChunkValue) {
EXPECT_EQ("bar", results[1]);
// Test extra chunks.
- key.num_chunks = 100;
+ key.max_length = 100;
results = ChunkCrashKeyValue(key, "hello world", 3);
ASSERT_EQ(4u, results.size());
EXPECT_EQ("hel", results[0]);

Powered by Google App Engine
This is Rietveld 408576698