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

Unified Diff: chrome/browser/process_singleton_posix_unittest.cc

Issue 2871793003: Added histograms on process singleton create when remote process exists and we cannot notify it (Closed)
Patch Set: Split histogram enums by platforms 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
Index: chrome/browser/process_singleton_posix_unittest.cc
diff --git a/chrome/browser/process_singleton_posix_unittest.cc b/chrome/browser/process_singleton_posix_unittest.cc
index 4c3922a030247d6d9f07d7a3089ecb010906a91d..623c076df8ada5a5693cda375607f0366b63cd24 100644
--- a/chrome/browser/process_singleton_posix_unittest.cc
+++ b/chrome/browser/process_singleton_posix_unittest.cc
@@ -27,6 +27,7 @@
#include "base/single_thread_task_runner.h"
#include "base/strings/stringprintf.h"
#include "base/synchronization/waitable_event.h"
+#include "base/test/histogram_tester.h"
#include "base/test/test_timeouts.h"
#include "base/test/thread_test_helper.h"
#include "base/threading/thread.h"
@@ -286,17 +287,22 @@ TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessSuccess) {
// Test failure case of NotifyOtherProcess().
TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessFailure) {
+ base::HistogramTester histogram_tester;
CreateProcessSingletonOnThread();
BlockWorkerThread();
EXPECT_EQ(ProcessSingleton::PROCESS_NONE, NotifyOtherProcess(true));
ASSERT_EQ(1, kill_callbacks_);
UnblockWorkerThread();
+ histogram_tester.ExpectUniqueSample(
+ "Chrome.ProcessSingleton.RemoteHungProcessTerminateReason",
+ ProcessSingleton::SOCKET_READ_FAILED, 1u);
}
// Test that we don't kill ourselves by accident if a lockfile with the same pid
// happens to exist.
TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessNoSuicide) {
+ base::HistogramTester histogram_tester;
CreateProcessSingletonOnThread();
// Replace lockfile with one containing our own pid.
EXPECT_EQ(0, unlink(lock_path_.value().c_str()));
@@ -312,6 +318,9 @@ TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessNoSuicide) {
EXPECT_EQ(ProcessSingleton::PROCESS_NONE, NotifyOtherProcess(false));
// If we've gotten to this point without killing ourself, the test succeeded.
+ histogram_tester.ExpectUniqueSample(
+ "Chrome.ProcessSingleton.RemoteProcessInteractionResult",
+ ProcessSingleton::ORPHANED_LOCK_FILE, 1u);
}
// Test that we can still notify a process on the same host even after the
@@ -408,6 +417,7 @@ TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessOrCreate_BadCookie) {
}
TEST_F(ProcessSingletonPosixTest, IgnoreSocketSymlinkWithTooLongTarget) {
+ base::HistogramTester histogram_tester;
CreateProcessSingletonOnThread();
// Change the symlink to one with a too-long target.
char buf[PATH_MAX];
@@ -423,6 +433,9 @@ TEST_F(ProcessSingletonPosixTest, IgnoreSocketSymlinkWithTooLongTarget) {
// A new ProcessSingleton should ignore the invalid socket path target.
std::string url("about:blank");
EXPECT_EQ(ProcessSingleton::PROCESS_NONE, NotifyOtherProcessOrCreate(url));
+ histogram_tester.ExpectUniqueSample(
+ "Chrome.ProcessSingleton.RemoteProcessInteractionResult",
+ ProcessSingleton::ORPHANED_LOCK_FILE, 1u);
}
#if defined(OS_MACOSX)

Powered by Google App Engine
This is Rietveld 408576698