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

Unified Diff: chrome/browser/process_singleton_win_unittest.cc

Issue 2871793003: Added histograms on process singleton create when remote process exists and we cannot notify it (Closed)
Patch Set: Updated histograms owners Created 3 years, 7 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
« no previous file with comments | « chrome/browser/process_singleton_win.cc ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/process_singleton_win_unittest.cc
diff --git a/chrome/browser/process_singleton_win_unittest.cc b/chrome/browser/process_singleton_win_unittest.cc
index 39225ffb0c2cf5783b2121562b6cbd5ecb049c5d..5db52e348ed855ee8eaad4af6b4089a7d88bdb7d 100644
--- a/chrome/browser/process_singleton_win_unittest.cc
+++ b/chrome/browser/process_singleton_win_unittest.cc
@@ -20,6 +20,7 @@
#include "base/process/process_handle.h"
#include "base/strings/string16.h"
#include "base/strings/stringprintf.h"
+#include "base/test/histogram_tester.h"
#include "base/test/multiprocess_test.h"
#include "base/win/scoped_handle.h"
#include "base/win/wrapped_window_proc.h"
@@ -235,6 +236,10 @@ class ProcessSingletonTest : public base::MultiProcessTest {
ProcessSingleton* test_singleton() const { return test_singleton_.get(); }
bool should_kill_called() const { return should_kill_called_; }
+ const base::HistogramTester& histogram_tester() const {
+ return histogram_tester_;
+ }
+
private:
bool MockShouldKillRemoteProcess(bool allow_kill) {
should_kill_called_ = true;
@@ -253,6 +258,7 @@ class ProcessSingletonTest : public base::MultiProcessTest {
base::TimeDelta old_notification_timeout_;
bool should_kill_called_;
+ base::HistogramTester histogram_tester_;
DISALLOW_COPY_AND_ASSIGN(ProcessSingletonTest);
};
@@ -275,6 +281,19 @@ TEST_F(ProcessSingletonTest, KillsHungBrowserWithNoWindows) {
// not have visible window.
EXPECT_FALSE(should_kill_called());
+ histogram_tester().ExpectUniqueSample(
+ "Chrome.ProcessSingleton.RemoteProcessInteractionResult",
+ ProcessSingleton::TERMINATE_SUCCEEDED, 1u);
+ histogram_tester().ExpectTotalCount(
+ "Chrome.ProcessSingleton.TerminateProcessTime", 1u);
+ histogram_tester().ExpectUniqueSample(
+ "Chrome.ProcessSingleton.ProcessTerminateErrorCode.Windows", 0, 1u);
+ histogram_tester().ExpectUniqueSample(
+ "Chrome.ProcessSingleton.TerminationWaitErrorCode.Windows", 0, 1u);
+ histogram_tester().ExpectUniqueSample(
+ "Chrome.ProcessSingleton.RemoteHungProcessTerminateReason",
+ ProcessSingleton::NO_VISIBLE_WINDOW_FOUND, 1u);
+
// Verify that the hung browser has been terminated with the
// RESULT_CODE_HUNG exit code.
int exit_code = 0;
@@ -296,6 +315,9 @@ TEST_F(ProcessSingletonTest, DoesntKillWithoutUserPermission) {
// visible window.
EXPECT_TRUE(should_kill_called());
+ histogram_tester().ExpectTotalCount(
+ "Chrome.ProcessSingleton.RemoteProcessInteractionResult", 0);
+
// Make sure the process hasn't been killed.
int exit_code = 0;
EXPECT_FALSE(
@@ -318,6 +340,19 @@ TEST_F(ProcessSingletonTest, KillWithUserPermission) {
// visible window.
EXPECT_TRUE(should_kill_called());
+ histogram_tester().ExpectUniqueSample(
+ "Chrome.ProcessSingleton.RemoteProcessInteractionResult",
+ ProcessSingleton::TERMINATE_SUCCEEDED, 1u);
+ histogram_tester().ExpectTotalCount(
+ "Chrome.ProcessSingleton.TerminateProcessTime", 1u);
+ histogram_tester().ExpectUniqueSample(
+ "Chrome.ProcessSingleton.ProcessTerminateErrorCode.Windows", 0, 1u);
+ histogram_tester().ExpectUniqueSample(
+ "Chrome.ProcessSingleton.TerminationWaitErrorCode.Windows", 0, 1u);
+ histogram_tester().ExpectUniqueSample(
+ "Chrome.ProcessSingleton.RemoteHungProcessTerminateReason",
+ ProcessSingleton::USER_ACCEPTED_TERMINATION, 1u);
+
// Verify that the hung browser has been terminated with the
// RESULT_CODE_HUNG exit code.
int exit_code = 0;
« no previous file with comments | « chrome/browser/process_singleton_win.cc ('k') | tools/metrics/histograms/enums.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698