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

Side by Side Diff: components/crash/content/app/fallback_crash_handler_win_unittest.cc

Issue 2653953002: Grab crash handler's peak commit charge in fallback handler (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « components/crash/content/app/fallback_crash_handler_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/content/app/fallback_crash_handler_win.h" 5 #include "components/crash/content/app/fallback_crash_handler_win.h"
6 6
7 #include <map>
8 #include <memory>
9 #include <string>
10 #include <vector>
11
7 #include "base/base_switches.h" 12 #include "base/base_switches.h"
8 #include "base/command_line.h" 13 #include "base/command_line.h"
9 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
10 #include "base/files/scoped_temp_dir.h" 15 #include "base/files/scoped_temp_dir.h"
11 #include "base/logging.h" 16 #include "base/logging.h"
12 #include "base/macros.h" 17 #include "base/macros.h"
13 #include "base/process/process_handle.h" 18 #include "base/process/process_handle.h"
14 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
15 #include "base/test/multiprocess_test.h" 20 #include "base/test/multiprocess_test.h"
16 #include "base/threading/platform_thread.h" 21 #include "base/threading/platform_thread.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 114
110 void TearDown() override { 115 void TearDown() override {
111 if (self_handle_ != base::kNullProcessHandle) { 116 if (self_handle_ != base::kNullProcessHandle) {
112 CloseHandle(self_handle_); 117 CloseHandle(self_handle_);
113 self_handle_ = base::kNullProcessHandle; 118 self_handle_ = base::kNullProcessHandle;
114 } 119 }
115 } 120 }
116 121
117 std::string SelfHandleAsString() const { 122 std::string SelfHandleAsString() const {
118 return base::UintToString(base::win::HandleToUint32(self_handle_)); 123 return base::UintToString(base::win::HandleToUint32(self_handle_));
119 }; 124 }
120 125
121 void CreateDatabase() { 126 void CreateDatabase() {
122 std::unique_ptr<crashpad::CrashReportDatabase> database = 127 std::unique_ptr<crashpad::CrashReportDatabase> database =
123 crashpad::CrashReportDatabase::InitializeWithoutCreating( 128 crashpad::CrashReportDatabase::InitializeWithoutCreating(
124 database_dir_.GetPath()); 129 database_dir_.GetPath());
125 } 130 }
126 131
127 protected: 132 protected:
128 base::ProcessHandle self_handle_; 133 base::ProcessHandle self_handle_;
129 base::ScopedTempDir database_dir_; 134 base::ScopedTempDir database_dir_;
130 135
136 private:
131 DISALLOW_COPY_AND_ASSIGN(FallbackCrashHandlerWinTest); 137 DISALLOW_COPY_AND_ASSIGN(FallbackCrashHandlerWinTest);
132 }; 138 };
133 139
134 } // namespace 140 } // namespace
135 141
136 TEST_F(FallbackCrashHandlerWinTest, ParseCommandLine) { 142 TEST_F(FallbackCrashHandlerWinTest, ParseCommandLine) {
137 FallbackCrashHandler handler; 143 FallbackCrashHandler handler;
138 144
139 // An empty command line shouldn't work. 145 // An empty command line shouldn't work.
140 base::CommandLine cmd_line(base::FilePath(L"empty")); 146 base::CommandLine cmd_line(base::FilePath(L"empty"));
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 it = parameters.find("ProcessPrivateUsage"); 238 it = parameters.find("ProcessPrivateUsage");
233 EXPECT_NE(parameters.end(), it); 239 EXPECT_NE(parameters.end(), it);
234 EXPECT_TRUE(base::StringToUint64(it->second, &int_value)); 240 EXPECT_TRUE(base::StringToUint64(it->second, &int_value));
235 EXPECT_NE(0U, int_value); 241 EXPECT_NE(0U, int_value);
236 242
237 it = parameters.find("ProcessPeakWorkingSetSize"); 243 it = parameters.find("ProcessPeakWorkingSetSize");
238 EXPECT_NE(parameters.end(), it); 244 EXPECT_NE(parameters.end(), it);
239 EXPECT_TRUE(base::StringToUint64(it->second, &int_value)); 245 EXPECT_TRUE(base::StringToUint64(it->second, &int_value));
240 EXPECT_NE(0U, int_value); 246 EXPECT_NE(0U, int_value);
241 247
248 it = parameters.find("ProcessPeakPagefileUsage");
249 EXPECT_NE(parameters.end(), it);
250 EXPECT_TRUE(base::StringToUint64(it->second, &int_value));
251 EXPECT_NE(0U, int_value);
252
242 it = parameters.find("SystemCommitRemaining"); 253 it = parameters.find("SystemCommitRemaining");
243 EXPECT_NE(parameters.end(), it); 254 EXPECT_NE(parameters.end(), it);
244 EXPECT_TRUE(base::StringToUint64(it->second, &int_value)); 255 EXPECT_TRUE(base::StringToUint64(it->second, &int_value));
245 // TODO(siggi): disable if this flakes, though bots shouldn't be that hard up 256 // TODO(siggi): disable if this flakes, though bots shouldn't be that hard up
246 // on memory :). 257 // on memory :).
247 EXPECT_NE(0U, int_value); 258 EXPECT_NE(0U, int_value);
248 259
249 it = parameters.find("SystemCommitLimit"); 260 it = parameters.find("SystemCommitLimit");
250 EXPECT_NE(parameters.end(), it); 261 EXPECT_NE(parameters.end(), it);
251 EXPECT_TRUE(base::StringToUint64(it->second, &int_value)); 262 EXPECT_TRUE(base::StringToUint64(it->second, &int_value));
252 EXPECT_NE(0U, int_value); 263 EXPECT_NE(0U, int_value);
253 } 264 }
254 265
255 } // namespace crash_reporter 266 } // namespace crash_reporter
OLDNEW
« no previous file with comments | « components/crash/content/app/fallback_crash_handler_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698