Cleanup: Better constify some strings in base.

Fix some lint errors along the way.

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

Cr-Commit-Position: refs/heads/master@{#300407}


CrOS-Libchrome-Original-Commit: 073d514d518521a5c409d5037b45e0a46602c997
diff --git a/base/debug/crash_logging_unittest.cc b/base/debug/crash_logging_unittest.cc
index 8c252f0..cb11f13 100644
--- a/base/debug/crash_logging_unittest.cc
+++ b/base/debug/crash_logging_unittest.cc
@@ -44,7 +44,7 @@
 };
 
 TEST_F(CrashLoggingTest, SetClearSingle) {
-  const char* kTestKey = "test-key";
+  const char kTestKey[] = "test-key";
   base::debug::CrashKey keys[] = { { kTestKey, 255 } };
   base::debug::InitCrashKeys(keys, arraysize(keys), 255);
 
@@ -56,10 +56,10 @@
 }
 
 TEST_F(CrashLoggingTest, SetChunked) {
-  const char* kTestKey = "chunky";
-  const char* kChunk1 = "chunky-1";
-  const char* kChunk2 = "chunky-2";
-  const char* kChunk3 = "chunky-3";
+  const char kTestKey[] = "chunky";
+  const char kChunk1[] = "chunky-1";
+  const char kChunk2[] = "chunky-2";
+  const char kChunk3[] = "chunky-3";
   base::debug::CrashKey keys[] = { { kTestKey, 15 } };
   base::debug::InitCrashKeys(keys, arraysize(keys), 5);
 
@@ -104,7 +104,7 @@
 }
 
 TEST_F(CrashLoggingTest, ScopedCrashKey) {
-  const char* kTestKey = "test-key";
+  const char kTestKey[] = "test-key";
   base::debug::CrashKey keys[] = { { kTestKey, 255 } };
   base::debug::InitCrashKeys(keys, arraysize(keys), 255);
 
diff --git a/base/debug/proc_maps_linux_unittest.cc b/base/debug/proc_maps_linux_unittest.cc
index 4be5a0f..d5d1b83 100644
--- a/base/debug/proc_maps_linux_unittest.cc
+++ b/base/debug/proc_maps_linux_unittest.cc
@@ -239,7 +239,7 @@
 }
 
 TEST(ProcMapsTest, MissingFields) {
-  static const char* kTestCases[] = {
+  static const char* const kTestCases[] = {
     "00400000\n",                               // Missing end + beyond.
     "00400000-0040b000\n",                      // Missing perms + beyond.
     "00400000-0040b000 r-xp\n",                 // Missing offset + beyond.
@@ -261,7 +261,7 @@
 }
 
 TEST(ProcMapsTest, InvalidInput) {
-  static const char* kTestCases[] = {
+  static const char* const kTestCases[] = {
     "thisisal-0040b000 rwxp 00000000 fc:00 794418 /bin/cat\n",
     "0040000d-linvalid rwxp 00000000 fc:00 794418 /bin/cat\n",
     "00400000-0040b000 inpu 00000000 fc:00 794418 /bin/cat\n",
diff --git a/base/debug/trace_event_android.cc b/base/debug/trace_event_android.cc
index 1e78b45..f08fffc 100644
--- a/base/debug/trace_event_android.cc
+++ b/base/debug/trace_event_android.cc
@@ -15,7 +15,7 @@
 namespace {
 
 int g_atrace_fd = -1;
-const char* kATraceMarkerFile = "/sys/kernel/debug/tracing/trace_marker";
+const char kATraceMarkerFile[] = "/sys/kernel/debug/tracing/trace_marker";
 
 void WriteEvent(
     char phase,
diff --git a/base/debug/trace_event_impl.h b/base/debug/trace_event_impl.h
index bac74e3..79bdc97 100644
--- a/base/debug/trace_event_impl.h
+++ b/base/debug/trace_event_impl.h
@@ -179,7 +179,7 @@
 // TraceBufferChunk is the basic unit of TraceBuffer.
 class BASE_EXPORT TraceBufferChunk {
  public:
-  TraceBufferChunk(uint32 seq)
+  explicit TraceBufferChunk(uint32 seq)
       : next_free_(0),
         seq_(seq) {
   }
@@ -281,7 +281,7 @@
   // The default category filter, used when none is provided.
   // Allows all categories through, except if they end in the suffix 'Debug' or
   // 'Test'.
-  static const char* kDefaultCategoryFilterString;
+  static const char kDefaultCategoryFilterString[];
 
   // |filter_string| is a comma-delimited list of category wildcards.
   // A category can have an optional '-' prefix to make it an excluded category.
@@ -380,13 +380,12 @@
 };
 
 struct BASE_EXPORT TraceOptions {
-
   TraceOptions()
       : record_mode(RECORD_UNTIL_FULL),
         enable_sampling(false),
         enable_systrace(false) {}
 
-  TraceOptions(TraceRecordMode record_mode)
+  explicit TraceOptions(TraceRecordMode record_mode)
       : record_mode(record_mode),
         enable_sampling(false),
         enable_systrace(false) {}
diff --git a/base/debug/trace_event_impl_constants.cc b/base/debug/trace_event_impl_constants.cc
index 24d7af7..8e01411 100644
--- a/base/debug/trace_event_impl_constants.cc
+++ b/base/debug/trace_event_impl_constants.cc
@@ -8,7 +8,7 @@
 namespace debug {
 
 // Enable everything but debug and test categories by default.
-const char* CategoryFilter::kDefaultCategoryFilterString = "-*Debug,-*Test";
+const char CategoryFilter::kDefaultCategoryFilterString[] = "-*Debug,-*Test";
 
 // Constant used by TraceLog's internal implementation of trace_option.
 const TraceLog::InternalTraceOptions
diff --git a/base/debug/trace_event_unittest.cc b/base/debug/trace_event_unittest.cc
index 90be070..836a0bb 100644
--- a/base/debug/trace_event_unittest.cc
+++ b/base/debug/trace_event_unittest.cc
@@ -252,7 +252,6 @@
 }
 
 void TraceEventTestFixture::DropTracedMetadataRecords() {
-
   scoped_ptr<ListValue> old_trace_parsed(trace_parsed_.DeepCopy());
   size_t old_trace_parsed_size = old_trace_parsed->GetSize();
   trace_parsed_.Clear();
@@ -266,7 +265,7 @@
     }
     DictionaryValue* dict = static_cast<DictionaryValue*>(value);
     std::string tmp;
-    if(dict->GetString("ph", &tmp) && tmp == "M")
+    if (dict->GetString("ph", &tmp) && tmp == "M")
       continue;
 
     trace_parsed_.Append(value->DeepCopy());
@@ -377,7 +376,7 @@
   return hits;
 }
 
-const char* kControlCharacters = "\001\002\003\n\r";
+const char kControlCharacters[] = "\001\002\003\n\r";
 
 void TraceWithAllMacroVariants(WaitableEvent* task_complete_event) {
   {
@@ -478,7 +477,7 @@
 
     TRACE_EVENT1(kControlCharacters, kControlCharacters,
                  kControlCharacters, kControlCharacters);
-  } // Scope close causes TRACE_EVENT0 etc to send their END events.
+  }  // Scope close causes TRACE_EVENT0 etc to send their END events.
 
   if (task_complete_event)
     task_complete_event->Signal();
@@ -1300,12 +1299,12 @@
   BeginTrace();
 
   unsigned long long id = 0xfeedbeeffeedbeefull;
-  TRACE_EVENT_ASYNC_BEGIN0( "cat", "name1", id);
-  TRACE_EVENT_ASYNC_STEP_INTO0( "cat", "name1", id, "step1");
+  TRACE_EVENT_ASYNC_BEGIN0("cat", "name1", id);
+  TRACE_EVENT_ASYNC_STEP_INTO0("cat", "name1", id, "step1");
   TRACE_EVENT_ASYNC_END0("cat", "name1", id);
-  TRACE_EVENT_BEGIN0( "cat", "name2");
-  TRACE_EVENT_ASYNC_BEGIN0( "cat", "name3", 0);
-  TRACE_EVENT_ASYNC_STEP_PAST0( "cat", "name3", 0, "step2");
+  TRACE_EVENT_BEGIN0("cat", "name2");
+  TRACE_EVENT_ASYNC_BEGIN0("cat", "name3", 0);
+  TRACE_EVENT_ASYNC_STEP_PAST0("cat", "name3", 0, "step2");
 
   EndTraceAndFlush();
 
@@ -1332,13 +1331,13 @@
 
   TraceLog::GetInstance()->SetProcessID(100);
   BeginTrace();
-  TRACE_EVENT_ASYNC_BEGIN0( "cat", "name1", ptr);
-  TRACE_EVENT_ASYNC_BEGIN0( "cat", "name2", ptr);
+  TRACE_EVENT_ASYNC_BEGIN0("cat", "name1", ptr);
+  TRACE_EVENT_ASYNC_BEGIN0("cat", "name2", ptr);
   EndTraceAndFlush();
 
   TraceLog::GetInstance()->SetProcessID(200);
   BeginTrace();
-  TRACE_EVENT_ASYNC_END0( "cat", "name1", ptr);
+  TRACE_EVENT_ASYNC_END0("cat", "name1", ptr);
   EndTraceAndFlush();
 
   DictionaryValue* async_begin = FindNamePhase("name1", "S");
@@ -1490,32 +1489,32 @@
 TEST_F(TraceEventTestFixture, ThreadNames) {
   // Create threads before we enable tracing to make sure
   // that tracelog still captures them.
-  const int num_threads = 4;
-  const int num_events = 10;
-  Thread* threads[num_threads];
-  PlatformThreadId thread_ids[num_threads];
-  for (int i = 0; i < num_threads; i++)
+  const int kNumThreads = 4;
+  const int kNumEvents = 10;
+  Thread* threads[kNumThreads];
+  PlatformThreadId thread_ids[kNumThreads];
+  for (int i = 0; i < kNumThreads; i++)
     threads[i] = new Thread(StringPrintf("Thread %d", i));
 
   // Enable tracing.
   BeginTrace();
 
   // Now run some trace code on these threads.
-  WaitableEvent* task_complete_events[num_threads];
-  for (int i = 0; i < num_threads; i++) {
+  WaitableEvent* task_complete_events[kNumThreads];
+  for (int i = 0; i < kNumThreads; i++) {
     task_complete_events[i] = new WaitableEvent(false, false);
     threads[i]->Start();
     thread_ids[i] = threads[i]->thread_id();
     threads[i]->message_loop()->PostTask(
         FROM_HERE, base::Bind(&TraceManyInstantEvents,
-                              i, num_events, task_complete_events[i]));
+                              i, kNumEvents, task_complete_events[i]));
   }
-  for (int i = 0; i < num_threads; i++) {
+  for (int i = 0; i < kNumThreads; i++) {
     task_complete_events[i]->Wait();
   }
 
   // Shut things down.
-  for (int i = 0; i < num_threads; i++) {
+  for (int i = 0; i < kNumThreads; i++) {
     threads[i]->Stop();
     delete threads[i];
     delete task_complete_events[i];
@@ -1538,7 +1537,7 @@
     EXPECT_TRUE(item->GetInteger("tid", &tmp_int));
 
     // See if this thread name is one of the threads we just created
-    for (int j = 0; j < num_threads; j++) {
+    for (int j = 0; j < kNumThreads; j++) {
       if(static_cast<int>(thread_ids[j]) != tmp_int)
         continue;
 
@@ -2969,7 +2968,7 @@
 }
 
 TEST_F(TraceEventTestFixture, BadSyntheticDelayConfigurations) {
-  const char* configs[] = {
+  const char* const configs[] = {
     "",
     "DELAY(",
     "DELAY(;",
diff --git a/base/environment_unittest.cc b/base/environment_unittest.cc
index e8c1906..f0577a8 100644
--- a/base/environment_unittest.cc
+++ b/base/environment_unittest.cc
@@ -21,8 +21,8 @@
 
 TEST_F(EnvironmentTest, GetVarReverse) {
   scoped_ptr<Environment> env(Environment::Create());
-  const char* kFooUpper = "FOO";
-  const char* kFooLower = "foo";
+  const char kFooUpper[] = "FOO";
+  const char kFooLower[] = "foo";
 
   // Set a variable in UPPER case.
   EXPECT_TRUE(env->SetVar(kFooUpper, kFooLower));
@@ -35,7 +35,7 @@
 
   EXPECT_TRUE(env->UnSetVar(kFooUpper));
 
-  const char* kBar = "bar";
+  const char kBar[] = "bar";
   // Now do the opposite, set the variable in the lower case.
   EXPECT_TRUE(env->SetVar(kFooLower, kBar));
 
@@ -56,8 +56,8 @@
 TEST_F(EnvironmentTest, SetVar) {
   scoped_ptr<Environment> env(Environment::Create());
 
-  const char* kFooUpper = "FOO";
-  const char* kFooLower = "foo";
+  const char kFooUpper[] = "FOO";
+  const char kFooLower[] = "foo";
   EXPECT_TRUE(env->SetVar(kFooUpper, kFooLower));
 
   // Now verify that the environment has the new variable.
@@ -71,8 +71,8 @@
 TEST_F(EnvironmentTest, UnSetVar) {
   scoped_ptr<Environment> env(Environment::Create());
 
-  const char* kFooUpper = "FOO";
-  const char* kFooLower = "foo";
+  const char kFooUpper[] = "FOO";
+  const char kFooLower[] = "foo";
   // First set some environment variable.
   EXPECT_TRUE(env->SetVar(kFooUpper, kFooLower));
 
@@ -95,7 +95,7 @@
   string16 e;
 
   e = AlterEnvironment(empty, changes);
-  EXPECT_TRUE(e[0] == 0);
+  EXPECT_EQ(0, e[0]);
 
   changes[L"A"] = L"1";
   e = AlterEnvironment(empty, changes);
diff --git a/base/files/file_path.cc b/base/files/file_path.cc
index 11bf69d..bf37be6 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -35,8 +35,8 @@
 
 namespace {
 
-const char* kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2", "bz" };
-const char* kCommonDoubleExtensions[] = { "user.js" };
+const char* const kCommonDoubleExtensionSuffixes[] = { "gz", "z", "bz2", "bz" };
+const char* const kCommonDoubleExtensions[] = { "user.js" };
 
 const FilePath::CharType kStringTerminator = FILE_PATH_LITERAL('\0');
 
diff --git a/base/i18n/break_iterator_unittest.cc b/base/i18n/break_iterator_unittest.cc
index 8569135..220a996 100644
--- a/base/i18n/break_iterator_unittest.cc
+++ b/base/i18n/break_iterator_unittest.cc
@@ -89,7 +89,7 @@
 
 TEST(BreakIteratorTest, BreakWide32) {
   // U+1D49C MATHEMATICAL SCRIPT CAPITAL A
-  const char* very_wide_char = "\xF0\x9D\x92\x9C";
+  const char very_wide_char[] = "\xF0\x9D\x92\x9C";
   const string16 str(
       UTF8ToUTF16(base::StringPrintf("%s a", very_wide_char)));
   const string16 very_wide_word(str.substr(0, 2));
@@ -194,7 +194,7 @@
 
 TEST(BreakIteratorTest, BreakSpaceWide32) {
   // U+1D49C MATHEMATICAL SCRIPT CAPITAL A
-  const char* very_wide_char = "\xF0\x9D\x92\x9C";
+  const char very_wide_char[] = "\xF0\x9D\x92\x9C";
   const string16 str(
       UTF8ToUTF16(base::StringPrintf("%s a", very_wide_char)));
   const string16 very_wide_word(str.substr(0, 3));
@@ -292,7 +292,7 @@
 
 TEST(BreakIteratorTest, BreakLineWide32) {
   // U+1D49C MATHEMATICAL SCRIPT CAPITAL A
-  const char* very_wide_char = "\xF0\x9D\x92\x9C";
+  const char very_wide_char[] = "\xF0\x9D\x92\x9C";
   const string16 str(
       UTF8ToUTF16(base::StringPrintf("%s\na", very_wide_char)));
   const string16 very_wide_line(str.substr(0, 3));
@@ -345,7 +345,7 @@
   const string16 long_string(ASCIIToUTF16("another,string"));
   EXPECT_TRUE(iter.SetText(long_string.c_str(), long_string.size()));
   EXPECT_TRUE(iter.Advance());
-  EXPECT_TRUE(iter.Advance()); // Advance to ',' in |long_string|
+  EXPECT_TRUE(iter.Advance());  // Advance to ',' in |long_string|
 
   // Check that the current position is out of bounds of the |initial_string|.
   EXPECT_LT(initial_string.size(), iter.pos());
diff --git a/base/json/json_file_value_serializer.cc b/base/json/json_file_value_serializer.cc
index d7d54f2..d60f800 100644
--- a/base/json/json_file_value_serializer.cc
+++ b/base/json/json_file_value_serializer.cc
@@ -10,10 +10,10 @@
 
 using base::FilePath;
 
-const char* JSONFileValueSerializer::kAccessDenied = "Access denied.";
-const char* JSONFileValueSerializer::kCannotReadFile = "Can't read file.";
-const char* JSONFileValueSerializer::kFileLocked = "File locked.";
-const char* JSONFileValueSerializer::kNoSuchFile = "File doesn't exist.";
+const char JSONFileValueSerializer::kAccessDenied[] = "Access denied.";
+const char JSONFileValueSerializer::kCannotReadFile[] = "Can't read file.";
+const char JSONFileValueSerializer::kFileLocked[] = "File locked.";
+const char JSONFileValueSerializer::kNoSuchFile[] = "File doesn't exist.";
 
 bool JSONFileValueSerializer::Serialize(const base::Value& root) {
   return SerializeInternal(root, false);
diff --git a/base/json/json_file_value_serializer.h b/base/json/json_file_value_serializer.h
index fc12b6b..642729f 100644
--- a/base/json/json_file_value_serializer.h
+++ b/base/json/json_file_value_serializer.h
@@ -58,10 +58,10 @@
   };
 
   // File-specific error messages that can be returned.
-  static const char* kAccessDenied;
-  static const char* kCannotReadFile;
-  static const char* kFileLocked;
-  static const char* kNoSuchFile;
+  static const char kAccessDenied[];
+  static const char kCannotReadFile[];
+  static const char kFileLocked[];
+  static const char kNoSuchFile[];
 
   // Convert an error code into an error message.  |error_code| is assumed to
   // be a JsonFileError.
diff --git a/base/json/json_parser.cc b/base/json/json_parser.cc
index a74da5f..5e59a46 100644
--- a/base/json/json_parser.cc
+++ b/base/json/json_parser.cc
@@ -901,7 +901,7 @@
 Value* JSONParser::ConsumeLiteral() {
   switch (*pos_) {
     case 't': {
-      const char* kTrueLiteral = "true";
+      const char kTrueLiteral[] = "true";
       const int kTrueLen = static_cast<int>(strlen(kTrueLiteral));
       if (!CanConsume(kTrueLen - 1) ||
           !StringsAreEqual(pos_, kTrueLiteral, kTrueLen)) {
@@ -912,7 +912,7 @@
       return new FundamentalValue(true);
     }
     case 'f': {
-      const char* kFalseLiteral = "false";
+      const char kFalseLiteral[] = "false";
       const int kFalseLen = static_cast<int>(strlen(kFalseLiteral));
       if (!CanConsume(kFalseLen - 1) ||
           !StringsAreEqual(pos_, kFalseLiteral, kFalseLen)) {
@@ -923,7 +923,7 @@
       return new FundamentalValue(false);
     }
     case 'n': {
-      const char* kNullLiteral = "null";
+      const char kNullLiteral[] = "null";
       const int kNullLen = static_cast<int>(strlen(kNullLiteral));
       if (!CanConsume(kNullLen - 1) ||
           !StringsAreEqual(pos_, kNullLiteral, kNullLen)) {
diff --git a/base/json/json_reader.cc b/base/json/json_reader.cc
index cbf6c99..ad5a9d5 100644
--- a/base/json/json_reader.cc
+++ b/base/json/json_reader.cc
@@ -13,21 +13,21 @@
 COMPILE_ASSERT(JSONReader::JSON_PARSE_ERROR_COUNT < 1000,
                json_reader_error_out_of_bounds);
 
-const char* JSONReader::kInvalidEscape =
+const char JSONReader::kInvalidEscape[] =
     "Invalid escape sequence.";
-const char* JSONReader::kSyntaxError =
+const char JSONReader::kSyntaxError[] =
     "Syntax error.";
-const char* JSONReader::kUnexpectedToken =
+const char JSONReader::kUnexpectedToken[] =
     "Unexpected token.";
-const char* JSONReader::kTrailingComma =
+const char JSONReader::kTrailingComma[] =
     "Trailing comma not allowed.";
-const char* JSONReader::kTooMuchNesting =
+const char JSONReader::kTooMuchNesting[] =
     "Too much nesting.";
-const char* JSONReader::kUnexpectedDataAfterRoot =
+const char JSONReader::kUnexpectedDataAfterRoot[] =
     "Unexpected data after root element.";
-const char* JSONReader::kUnsupportedEncoding =
+const char JSONReader::kUnsupportedEncoding[] =
     "Unsupported encoding. JSON must be UTF-8.";
-const char* JSONReader::kUnquotedDictionaryKey =
+const char JSONReader::kUnquotedDictionaryKey[] =
     "Dictionary keys must be quoted.";
 
 JSONReader::JSONReader()
diff --git a/base/json/json_reader.h b/base/json/json_reader.h
index 79129ce..fd053d4 100644
--- a/base/json/json_reader.h
+++ b/base/json/json_reader.h
@@ -75,14 +75,14 @@
   };
 
   // String versions of parse error codes.
-  static const char* kInvalidEscape;
-  static const char* kSyntaxError;
-  static const char* kUnexpectedToken;
-  static const char* kTrailingComma;
-  static const char* kTooMuchNesting;
-  static const char* kUnexpectedDataAfterRoot;
-  static const char* kUnsupportedEncoding;
-  static const char* kUnquotedDictionaryKey;
+  static const char kInvalidEscape[];
+  static const char kSyntaxError[];
+  static const char kUnexpectedToken[];
+  static const char kTrailingComma[];
+  static const char kTooMuchNesting[];
+  static const char kUnexpectedDataAfterRoot[];
+  static const char kUnsupportedEncoding[];
+  static const char kUnquotedDictionaryKey[];
 
   // Constructs a reader with the default options, JSON_PARSE_RFC.
   JSONReader();
diff --git a/base/json/json_reader_unittest.cc b/base/json/json_reader_unittest.cc
index 67070ff..a3ec4f7 100644
--- a/base/json/json_reader_unittest.cc
+++ b/base/json/json_reader_unittest.cc
@@ -505,7 +505,7 @@
   EXPECT_EQ("\xf0\x9f\x92\xa9\xf0\x9f\x91\xac", str_val);
 
   // Test invalid utf16 strings.
-  const char* cases[] = {
+  const char* const cases[] = {
     "\"\\u123\"",  // Invalid scalar.
     "\"\\ud83d\"",  // Invalid scalar.
     "\"\\u$%@!\"",  // Invalid scalar.
@@ -627,7 +627,7 @@
 // parser implementation against buffer overflow. Best run with DCHECKs so
 // that the one in NextChar fires.
 TEST(JSONReaderTest, InvalidSanity) {
-  const char* invalid_json[] = {
+  const char* const invalid_json[] = {
       "/* test *",
       "{\"foo\"",
       "{\"foo\":",
diff --git a/base/md5_unittest.cc b/base/md5_unittest.cc
index 3e7f2ad..8d817e9 100644
--- a/base/md5_unittest.cc
+++ b/base/md5_unittest.cc
@@ -33,7 +33,7 @@
 
 TEST(MD5, MD5SumEmtpyData) {
   MD5Digest digest;
-  const char* data = "";
+  const char data[] = "";
 
   MD5Sum(data, strlen(data), &digest);
 
@@ -50,7 +50,7 @@
 
 TEST(MD5, MD5SumOneByteData) {
   MD5Digest digest;
-  const char* data = "a";
+  const char data[] = "a";
 
   MD5Sum(data, strlen(data), &digest);
 
diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc
index b474ddb..5080d65 100644
--- a/base/metrics/field_trial_unittest.cc
+++ b/base/metrics/field_trial_unittest.cc
@@ -78,8 +78,8 @@
 // Test registration, and also check that destructors are called for trials
 // (and that Valgrind doesn't catch us leaking).
 TEST_F(FieldTrialTest, Registration) {
-  const char* name1 = "name 1 test";
-  const char* name2 = "name 2 test";
+  const char name1[] = "name 1 test";
+  const char name2[] = "name 2 test";
   EXPECT_FALSE(FieldTrialList::Find(name1));
   EXPECT_FALSE(FieldTrialList::Find(name2));
 
diff --git a/base/nix/xdg_util_unittest.cc b/base/nix/xdg_util_unittest.cc
index 2fc9d4c..6d10d3e 100644
--- a/base/nix/xdg_util_unittest.cc
+++ b/base/nix/xdg_util_unittest.cc
@@ -25,10 +25,10 @@
   MOCK_METHOD1(UnSetVar, bool(const char*));
 };
 
-const char* kGnome = "gnome";
-const char* kKDE4 = "kde4";
-const char* kKDE = "kde";
-const char* kXFCE = "xfce";
+const char* const kGnome = "gnome";
+const char* const kKDE4 = "kde4";
+const char* const kKDE = "kde";
+const char* const kXFCE = "xfce";
 
 }  // namespace
 
diff --git a/base/prefs/overlay_user_pref_store_unittest.cc b/base/prefs/overlay_user_pref_store_unittest.cc
index 18e9a5c..66a7b3b 100644
--- a/base/prefs/overlay_user_pref_store_unittest.cc
+++ b/base/prefs/overlay_user_pref_store_unittest.cc
@@ -19,12 +19,12 @@
 const char kBrowserWindowPlacement[] = "browser.window_placement";
 const char kShowBookmarkBar[] = "bookmark_bar.show_on_all_tabs";
 
-const char* overlay_key = kBrowserWindowPlacement;
-const char* regular_key = kShowBookmarkBar;
+const char* const overlay_key = kBrowserWindowPlacement;
+const char* const regular_key = kShowBookmarkBar;
 // With the removal of the kWebKitGlobalXXX prefs, we'll no longer have real
 // prefs using the overlay pref store, so make up keys here.
-const char* mapped_overlay_key = "test.per_tab.javascript_enabled";
-const char* mapped_underlay_key = "test.per_profile.javascript_enabled";
+const char mapped_overlay_key[] = "test.per_tab.javascript_enabled";
+const char mapped_underlay_key[] = "test.per_profile.javascript_enabled";
 
 }  // namespace
 
diff --git a/base/strings/string_util_unittest.cc b/base/strings/string_util_unittest.cc
index a3e8992..f29baac 100644
--- a/base/strings/string_util_unittest.cc
+++ b/base/strings/string_util_unittest.cc
@@ -461,7 +461,7 @@
 }
 
 TEST(StringUtilTest, ConvertASCII) {
-  static const char* char_cases[] = {
+  static const char* const char_cases[] = {
     "Google Video",
     "Hello, world\n",
     "0123ABCDwxyz \a\b\t\r\n!+,.~"
@@ -566,7 +566,7 @@
     {99LL*1024*1024*1024, "99.0 GB"},
     {105LL*1024*1024*1024, "105 GB"},
     {105LL*1024*1024*1024 + 500LL*1024*1024, "105 GB"},
-    {~(1LL<<63), "8192 PB"},
+    {~(1LL << 63), "8192 PB"},
 
     {99*1024 + 103, "99.1 kB"},
     {1024*1024 + 103, "1.0 MB"},
@@ -1153,7 +1153,7 @@
 }
 
 TEST(StringUtilTest, RemoveChars) {
-  const char* kRemoveChars = "-/+*";
+  const char kRemoveChars[] = "-/+*";
   std::string input = "A-+bc/d!*";
   EXPECT_TRUE(RemoveChars(input, kRemoveChars, &input));
   EXPECT_EQ("Abcd!", input);
diff --git a/base/strings/stringprintf_unittest.cc b/base/strings/stringprintf_unittest.cc
index a1bf2da..4935b55 100644
--- a/base/strings/stringprintf_unittest.cc
+++ b/base/strings/stringprintf_unittest.cc
@@ -106,7 +106,7 @@
     src[i] = 'A';
   src[1025] = 0;
 
-  const char* fmt = "%sB%sB%sB%sB%sB%sB%s";
+  const char fmt[] = "%sB%sB%sB%sB%sB%sB%s";
 
   std::string out;
   SStringPrintf(&out, fmt, src, src, src, src, src, src, src);
@@ -132,14 +132,15 @@
 // Test the boundary condition for the size of the string_util's
 // internal buffer.
 TEST(StringPrintfTest, GrowBoundary) {
-  const int string_util_buf_len = 1024;
+  const int kStringUtilBufLen = 1024;
   // Our buffer should be one larger than the size of StringAppendVT's stack
   // buffer.
-  const int buf_len = string_util_buf_len + 1;
-  char src[buf_len + 1];  // Need extra one for NULL-terminator.
-  for (int i = 0; i < buf_len; ++i)
+  // And need extra one for NULL-terminator.
+  const int kBufLen = kStringUtilBufLen + 1 + 1;
+  char src[kBufLen];
+  for (int i = 0; i < kBufLen - 1; ++i)
     src[i] = 'a';
-  src[buf_len] = 0;
+  src[kBufLen - 1] = 0;
 
   std::string out;
   SStringPrintf(&out, "%s", src);
diff --git a/base/sys_info_chromeos.cc b/base/sys_info_chromeos.cc
index d3a1b2c..ef5f1fe 100644
--- a/base/sys_info_chromeos.cc
+++ b/base/sys_info_chromeos.cc
@@ -21,7 +21,7 @@
 
 namespace {
 
-const char* kLinuxStandardBaseVersionKeys[] = {
+const char* const kLinuxStandardBaseVersionKeys[] = {
   "CHROMEOS_RELEASE_VERSION",
   "GOOGLE_RELEASE",
   "DISTRIB_RELEASE",
diff --git a/base/sys_info_unittest.cc b/base/sys_info_unittest.cc
index bfd8224..29409ee 100644
--- a/base/sys_info_unittest.cc
+++ b/base/sys_info_unittest.cc
@@ -71,7 +71,7 @@
   int32 os_major_version = -1;
   int32 os_minor_version = -1;
   int32 os_bugfix_version = -1;
-  const char* kLsbRelease =
+  const char kLsbRelease[] =
       "FOO=1234123.34.5\n"
       "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
   base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
@@ -87,7 +87,7 @@
   int32 os_major_version = -1;
   int32 os_minor_version = -1;
   int32 os_bugfix_version = -1;
-  const char* kLsbRelease =
+  const char kLsbRelease[] =
       "CHROMEOS_RELEASE_VERSION=1.2.3.4\n"
       "FOO=1234123.34.5\n";
   base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
@@ -103,7 +103,7 @@
   int32 os_major_version = -1;
   int32 os_minor_version = -1;
   int32 os_bugfix_version = -1;
-  const char* kLsbRelease = "FOO=1234123.34.5\n";
+  const char kLsbRelease[] = "FOO=1234123.34.5\n";
   base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, base::Time());
   base::SysInfo::OperatingSystemVersionNumbers(&os_major_version,
                                                &os_minor_version,
@@ -114,7 +114,7 @@
 }
 
 TEST_F(SysInfoTest, GoogleChromeOSLsbReleaseTime) {
-  const char* kLsbRelease = "CHROMEOS_RELEASE_VERSION=1.2.3.4";
+  const char kLsbRelease[] = "CHROMEOS_RELEASE_VERSION=1.2.3.4";
   // Use a fake time that can be safely displayed as a string.
   const base::Time lsb_release_time(base::Time::FromDoubleT(12345.6));
   base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease, lsb_release_time);
@@ -127,19 +127,19 @@
   base::SysInfo::SetChromeOSVersionInfoForTest("", base::Time());
   EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
 
-  const char* kLsbRelease1 =
+  const char kLsbRelease1[] =
       "CHROMEOS_RELEASE_NAME=Non Chrome OS\n"
       "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
   base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease1, base::Time());
   EXPECT_FALSE(base::SysInfo::IsRunningOnChromeOS());
 
-  const char* kLsbRelease2 =
+  const char kLsbRelease2[] =
       "CHROMEOS_RELEASE_NAME=Chrome OS\n"
       "CHROMEOS_RELEASE_VERSION=1.2.3.4\n";
   base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease2, base::Time());
   EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
 
-  const char* kLsbRelease3 =
+  const char kLsbRelease3[] =
       "CHROMEOS_RELEASE_NAME=Chromium OS\n";
   base::SysInfo::SetChromeOSVersionInfoForTest(kLsbRelease3, base::Time());
   EXPECT_TRUE(base::SysInfo::IsRunningOnChromeOS());
diff --git a/base/test/expectations/expectation_unittest.cc b/base/test/expectations/expectation_unittest.cc
index 8a7af71..c0f55a1 100644
--- a/base/test/expectations/expectation_unittest.cc
+++ b/base/test/expectations/expectation_unittest.cc
@@ -71,7 +71,7 @@
 }
 
 TEST(TestExpectationsFunctionsTest, IsValidPlatform) {
-  const char* kValidPlatforms[] = {
+  const char* const kValidPlatforms[] = {
     "Win",
     "Win-XP",
     "Win-Vista",
@@ -89,7 +89,7 @@
     "Android",
   };
 
-  const char* kInvalidPlatforms[] = {
+  const char* const kInvalidPlatforms[] = {
     "Solaris",
     "Plan9",
   };
diff --git a/base/test/expectations/parser_unittest.cc b/base/test/expectations/parser_unittest.cc
index a456458..d1d10a5 100644
--- a/base/test/expectations/parser_unittest.cc
+++ b/base/test/expectations/parser_unittest.cc
@@ -161,7 +161,7 @@
 }
 
 TEST_F(TestExpectationParserTest, SyntaxErrors) {
-  const char* kErrors[] = {
+  const char* const kErrors[] = {
     "Foo [ dfasd",
     "Foo [Linux] # This is an illegal comment",
     "Foo [Linux] Bar # Another illegal comment.",
@@ -184,7 +184,7 @@
 }
 
 TEST_F(TestExpectationParserTest, DataErrors) {
-  const char* kOneError[] = {
+  const char* const kOneError[] = {
     "http://crbug.com/1234 [MagicBrowzR] BadModifier = Timeout",
     "________ [Linux] BadResult = WhatNow",
     "http://wkb.ug/1234 [Debug Release Win-7] MultipleConfigs = Skip",
@@ -196,7 +196,7 @@
     data_errors_.clear();
   }
 
-  const char* kTwoErrors[] = {
+  const char* const kTwoErrors[] = {
     ". [Mac-TurningIntoiOS] BadModifierVariant.BadResult = Foobar",
     "1234 [ Debug Release OS/2 ] MultipleConfigs.BadModifier = Pass",
   };
diff --git a/base/test/trace_event_analyzer_unittest.cc b/base/test/trace_event_analyzer_unittest.cc
index 5604508..0edeb14 100644
--- a/base/test/trace_event_analyzer_unittest.cc
+++ b/base/test/trace_event_analyzer_unittest.cc
@@ -86,7 +86,7 @@
 
   int int_num = 2;
   double double_num = 3.5;
-  const char* str = "the string";
+  const char str[] = "the string";
 
   TraceEvent event;
   event.arg_numbers["false"] = 0.0;
@@ -508,7 +508,7 @@
 TEST_F(TraceEventAnalyzerTest, MergeAssociatedEventArgs) {
   ManualSetUp();
 
-  const char* arg_string = "arg_string";
+  const char arg_string[] = "arg_string";
   BeginTracing();
   {
     TRACE_EVENT_BEGIN0("cat1", "name1");
diff --git a/base/threading/thread_id_name_manager_unittest.cc b/base/threading/thread_id_name_manager_unittest.cc
index 3777301..b5953d5 100644
--- a/base/threading/thread_id_name_manager_unittest.cc
+++ b/base/threading/thread_id_name_manager_unittest.cc
@@ -13,8 +13,8 @@
 
 namespace {
 
-static const char* kAThread = "a thread";
-static const char* kBThread = "b thread";
+const char kAThread[] = "a thread";
+const char kBThread[] = "b thread";
 
 TEST_F(ThreadIdNameManagerTest, AddThreads) {
   base::ThreadIdNameManager* manager = base::ThreadIdNameManager::GetInstance();