| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/crash/app/crash_keys_win.h" | 5 #include "components/crash/app/crash_keys_win.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "components/crash/app/crash_reporter_client.h" | 10 #include "components/crash/app/crash_reporter_client.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 MOCK_METHOD2(GetProductNameAndVersion, void(std::string* product_name, | 41 MOCK_METHOD2(GetProductNameAndVersion, void(std::string* product_name, |
| 42 std::string* version)); | 42 std::string* version)); |
| 43 MOCK_METHOD0(GetReporterLogFilename, base::FilePath()); | 43 MOCK_METHOD0(GetReporterLogFilename, base::FilePath()); |
| 44 MOCK_METHOD1(GetCrashDumpLocation, bool(base::FilePath* crash_dir)); | 44 MOCK_METHOD1(GetCrashDumpLocation, bool(base::FilePath* crash_dir)); |
| 45 MOCK_METHOD0(RegisterCrashKeys, size_t()); | 45 MOCK_METHOD0(RegisterCrashKeys, size_t()); |
| 46 MOCK_METHOD0(IsRunningUnattended, bool()); | 46 MOCK_METHOD0(IsRunningUnattended, bool()); |
| 47 MOCK_METHOD0(GetCollectStatsConsent, bool()); | 47 MOCK_METHOD0(GetCollectStatsConsent, bool()); |
| 48 MOCK_METHOD1(ReportingIsEnforcedByPolicy, bool(bool* breakpad_enabled)); | 48 MOCK_METHOD1(ReportingIsEnforcedByPolicy, bool(bool* breakpad_enabled)); |
| 49 MOCK_METHOD0(GetAndroidMinidumpDescriptor, int()); | 49 MOCK_METHOD0(GetAndroidMinidumpDescriptor, int()); |
| 50 #if defined(OS_MACOSX) | |
| 51 MOCK_METHOD1(InstallAdditionalFilters, void(BreakpadRef breakpad)); | |
| 52 #endif | |
| 53 MOCK_METHOD1(EnableBreakpadForProcess, bool(const std::string& process_type)); | 50 MOCK_METHOD1(EnableBreakpadForProcess, bool(const std::string& process_type)); |
| 54 }; | 51 }; |
| 55 | 52 |
| 56 class CrashKeysWinTest : public testing::Test { | 53 class CrashKeysWinTest : public testing::Test { |
| 57 public: | 54 public: |
| 58 | 55 |
| 59 size_t CountKeyValueOccurences( | 56 size_t CountKeyValueOccurences( |
| 60 const google_breakpad::CustomClientInfo* client_info, | 57 const google_breakpad::CustomClientInfo* client_info, |
| 61 const wchar_t* key, const wchar_t* value); | 58 const wchar_t* key, const wchar_t* value); |
| 62 | 59 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 EXPECT_EQ(1, CountKeyValueOccurences(info, L"plat", L"Win32")); | 133 EXPECT_EQ(1, CountKeyValueOccurences(info, L"plat", L"Win32")); |
| 137 EXPECT_EQ(1, CountKeyValueOccurences(info, L"ptype", L"made_up_type")); | 134 EXPECT_EQ(1, CountKeyValueOccurences(info, L"ptype", L"made_up_type")); |
| 138 std::wstring pid_str(base::StringPrintf(L"%d", ::GetCurrentProcessId())); | 135 std::wstring pid_str(base::StringPrintf(L"%d", ::GetCurrentProcessId())); |
| 139 EXPECT_EQ(1, CountKeyValueOccurences(info, L"pid", pid_str.c_str())); | 136 EXPECT_EQ(1, CountKeyValueOccurences(info, L"pid", pid_str.c_str())); |
| 140 EXPECT_EQ(1, CountKeyValueOccurences(info, L"channel", L"-devm")); | 137 EXPECT_EQ(1, CountKeyValueOccurences(info, L"channel", L"-devm")); |
| 141 EXPECT_EQ(1, CountKeyValueOccurences(info, L"profile-type", L"temporary")); | 138 EXPECT_EQ(1, CountKeyValueOccurences(info, L"profile-type", L"temporary")); |
| 142 EXPECT_EQ(256, CountKeyValueOccurences(info, L"unspecified-crash-key", L"")); | 139 EXPECT_EQ(256, CountKeyValueOccurences(info, L"unspecified-crash-key", L"")); |
| 143 } | 140 } |
| 144 | 141 |
| 145 } // namespace breakpad | 142 } // namespace breakpad |
| OLD | NEW |