Index: components/browser_watcher/watcher_metrics_provider_win_unittest.cc |
diff --git a/components/browser_watcher/watcher_metrics_provider_win_unittest.cc b/components/browser_watcher/watcher_metrics_provider_win_unittest.cc |
index fbce251f84b246c571d7df8f1acca3d70ed4b6e4..f9586d8292f4c0f392642169fd4e5030359b80ee 100644 |
--- a/components/browser_watcher/watcher_metrics_provider_win_unittest.cc |
+++ b/components/browser_watcher/watcher_metrics_provider_win_unittest.cc |
@@ -10,11 +10,11 @@ |
#include <cstdlib> |
#include "base/process/process_handle.h" |
+#include "base/run_loop.h" |
#include "base/strings/string16.h" |
#include "base/strings/stringprintf.h" |
#include "base/test/histogram_tester.h" |
#include "base/test/test_reg_util_win.h" |
-#include "base/test/test_simple_task_runner.h" |
#include "base/win/registry.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -36,7 +36,6 @@ class WatcherMetricsProviderWinTest : public testing::Test { |
ASSERT_NO_FATAL_FAILURE( |
override_manager_.OverrideRegistry(HKEY_CURRENT_USER)); |
- test_task_runner_ = new base::TestSimpleTaskRunner(); |
} |
void AddProcessExitCode(bool use_own_pid, int exit_code) { |
@@ -68,7 +67,6 @@ class WatcherMetricsProviderWinTest : public testing::Test { |
protected: |
registry_util::RegistryOverrideManager override_manager_; |
base::HistogramTester histogram_tester_; |
- scoped_refptr<base::TestSimpleTaskRunner> test_task_runner_; |
}; |
} // namespace |
@@ -81,9 +79,9 @@ TEST_F(WatcherMetricsProviderWinTest, RecordsStabilityHistogram) { |
// Record a single failure. |
AddProcessExitCode(false, 100); |
- WatcherMetricsProviderWin provider( |
- kRegistryPath, base::FilePath(), base::FilePath(), |
- GetExecutableDetailsCallback(), test_task_runner_.get()); |
+ WatcherMetricsProviderWin provider(kRegistryPath, base::FilePath(), |
+ base::FilePath(), |
+ GetExecutableDetailsCallback()); |
provider.ProvideStabilityMetrics(NULL); |
histogram_tester_.ExpectBucketCount( |
@@ -105,9 +103,9 @@ TEST_F(WatcherMetricsProviderWinTest, DoesNotReportOwnProcessId) { |
// Record own process as STILL_ACTIVE. |
AddProcessExitCode(true, STILL_ACTIVE); |
- WatcherMetricsProviderWin provider( |
- kRegistryPath, base::FilePath(), base::FilePath(), |
- GetExecutableDetailsCallback(), test_task_runner_.get()); |
+ WatcherMetricsProviderWin provider(kRegistryPath, base::FilePath(), |
+ base::FilePath(), |
+ GetExecutableDetailsCallback()); |
provider.ProvideStabilityMetrics(NULL); |
histogram_tester_.ExpectUniqueSample( |
@@ -128,21 +126,21 @@ TEST_F(WatcherMetricsProviderWinTest, DeletesExitcodeKeyWhenNotReporting) { |
AddProcessExitCode(false, 100); |
// Make like the user is opted out of reporting. |
- WatcherMetricsProviderWin provider( |
- kRegistryPath, base::FilePath(), base::FilePath(), |
- GetExecutableDetailsCallback(), test_task_runner_.get()); |
+ WatcherMetricsProviderWin provider(kRegistryPath, base::FilePath(), |
+ base::FilePath(), |
+ GetExecutableDetailsCallback()); |
provider.OnRecordingDisabled(); |
base::win::RegKey key; |
{ |
- // The deletion should be scheduled to the test_task_runner, and not happen |
+ // The deletion should be scheduled to the task scheduler, and not happen |
// immediately. |
ASSERT_EQ(ERROR_SUCCESS, |
key.Open(HKEY_CURRENT_USER, kRegistryPath, KEY_READ)); |
Ilya Sherman
2017/06/30 18:29:41
It's not clear to me whether this is appropriate t
manzagop (departed)
2017/06/30 20:11:43
Could this simply go to l.127?
Ilya Sherman
2017/07/03 02:35:07
It could, but it would be changing the meaning of
manzagop (departed)
2017/07/04 12:26:25
Ah, got it. So deletion is the intent and the post
Ilya Sherman
2017/07/05 18:09:42
Done.
|
} |
// Flush the task(s). |
- test_task_runner_->RunPendingTasks(); |
+ base::RunLoop().RunUntilIdle(); |
// Make sure the subkey for the pseudo process has been deleted on reporting. |
ASSERT_EQ(ERROR_FILE_NOT_FOUND, |