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

Unified Diff: chrome/common/crash_keys_unittest.cc

Issue 1481933002: Move crash keys for command-line switches to components/crash so they can be set (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@installer_crash_keys
Patch Set: typedef -> using, %lu -> PRIuS 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 | « chrome/common/crash_keys.cc ('k') | chrome/installer/setup/installer_crash_reporting.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/crash_keys_unittest.cc
diff --git a/chrome/common/crash_keys_unittest.cc b/chrome/common/crash_keys_unittest.cc
index 5dd04b2235b2405097558cb44eafc6d74b73b3c1..42f996a26eef51307bb488a00454ee3cd46c5511 100644
--- a/chrome/common/crash_keys_unittest.cc
+++ b/chrome/common/crash_keys_unittest.cc
@@ -57,50 +57,6 @@ class CrashKeysTest : public testing::Test {
CrashKeysTest* CrashKeysTest::self_ = NULL;
-TEST_F(CrashKeysTest, Switches) {
- // Set three switches.
- {
- base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
- for (int i = 1; i <= 3; ++i)
- command_line.AppendSwitch(base::StringPrintf("--flag-%d", i));
- crash_keys::SetSwitchesFromCommandLine(&command_line);
- EXPECT_EQ("--flag-1", GetKeyValue("switch-1"));
- EXPECT_EQ("--flag-2", GetKeyValue("switch-2"));
- EXPECT_EQ("--flag-3", GetKeyValue("switch-3"));
- EXPECT_FALSE(HasCrashKey("switch-4"));
- }
-
- // Set more than the max switches.
- {
- base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
- const int kMax = crash_keys::kSwitchesMaxCount + 2;
- EXPECT_GT(kMax, 15);
- for (int i = 1; i <= kMax; ++i)
- command_line.AppendSwitch(base::StringPrintf("--many-%d", i));
- crash_keys::SetSwitchesFromCommandLine(&command_line);
- EXPECT_EQ("--many-1", GetKeyValue("switch-1"));
- EXPECT_EQ("--many-9", GetKeyValue("switch-9"));
- EXPECT_EQ("--many-15", GetKeyValue("switch-15"));
- EXPECT_FALSE(HasCrashKey("switch-16"));
- EXPECT_FALSE(HasCrashKey("switch-17"));
- }
-
- // Set fewer to ensure that old ones are erased.
- {
- base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
- for (int i = 1; i <= 5; ++i)
- command_line.AppendSwitch(base::StringPrintf("--fewer-%d", i));
- crash_keys::SetSwitchesFromCommandLine(&command_line);
- EXPECT_EQ("--fewer-1", GetKeyValue("switch-1"));
- EXPECT_EQ("--fewer-2", GetKeyValue("switch-2"));
- EXPECT_EQ("--fewer-3", GetKeyValue("switch-3"));
- EXPECT_EQ("--fewer-4", GetKeyValue("switch-4"));
- EXPECT_EQ("--fewer-5", GetKeyValue("switch-5"));
- for (int i = 6; i < 20; ++i)
- EXPECT_FALSE(HasCrashKey(base::StringPrintf(crash_keys::kSwitch, i)));
- }
-}
-
TEST_F(CrashKeysTest, Extensions) {
// Set three extensions.
{
@@ -162,20 +118,21 @@ TEST_F(CrashKeysTest, Extensions) {
}
}
-#if defined(OS_CHROMEOS)
TEST_F(CrashKeysTest, IgnoreBoringFlags) {
base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
command_line.AppendSwitch("--enable-logging");
- command_line.AppendSwitch("--user-data-dir=/tmp");
command_line.AppendSwitch("--v=1");
- command_line.AppendSwitch("--default-wallpaper-small=test.png");
command_line.AppendSwitch("--vv=1");
command_line.AppendSwitch("--vvv");
command_line.AppendSwitch("--enable-multi-profiles");
command_line.AppendSwitch("--device-management-url=https://foo/bar");
+#if defined(OS_CHROMEOS)
+ command_line.AppendSwitch("--user-data-dir=/tmp");
+ command_line.AppendSwitch("--default-wallpaper-small=test.png");
+#endif
- crash_keys::SetSwitchesFromCommandLine(&command_line);
+ crash_keys::SetCrashKeysFromCommandLine(command_line);
EXPECT_EQ("--vv=1", GetKeyValue("switch-1"));
EXPECT_EQ("--vvv", GetKeyValue("switch-2"));
@@ -183,4 +140,3 @@ TEST_F(CrashKeysTest, IgnoreBoringFlags) {
EXPECT_EQ("--device-management-url=https://foo/bar", GetKeyValue("switch-4"));
EXPECT_FALSE(HasCrashKey("switch-5"));
}
-#endif
« no previous file with comments | « chrome/common/crash_keys.cc ('k') | chrome/installer/setup/installer_crash_reporting.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698