OLD | NEW |
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/browser_watcher/watcher_metrics_provider_win.h" | 5 #include "components/browser_watcher/watcher_metrics_provider_win.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <cstdlib> | 10 #include <cstdlib> |
(...skipping 16 matching lines...) Expand all Loading... |
27 | 27 |
28 const wchar_t kRegistryPath[] = L"Software\\WatcherMetricsProviderWinTest"; | 28 const wchar_t kRegistryPath[] = L"Software\\WatcherMetricsProviderWinTest"; |
29 | 29 |
30 class WatcherMetricsProviderWinTest : public testing::Test { | 30 class WatcherMetricsProviderWinTest : public testing::Test { |
31 public: | 31 public: |
32 typedef testing::Test Super; | 32 typedef testing::Test Super; |
33 | 33 |
34 void SetUp() override { | 34 void SetUp() override { |
35 Super::SetUp(); | 35 Super::SetUp(); |
36 | 36 |
37 override_manager_.OverrideRegistry(HKEY_CURRENT_USER); | 37 ASSERT_NO_FATAL_FAILURE( |
| 38 override_manager_.OverrideRegistry(HKEY_CURRENT_USER)); |
38 test_task_runner_ = new base::TestSimpleTaskRunner(); | 39 test_task_runner_ = new base::TestSimpleTaskRunner(); |
39 } | 40 } |
40 | 41 |
41 void AddProcessExitCode(bool use_own_pid, int exit_code) { | 42 void AddProcessExitCode(bool use_own_pid, int exit_code) { |
42 int pid = 0; | 43 int pid = 0; |
43 if (use_own_pid) { | 44 if (use_own_pid) { |
44 pid = base::GetCurrentProcId(); | 45 pid = base::GetCurrentProcId(); |
45 } else { | 46 } else { |
46 // Make sure not to accidentally collide with own pid. | 47 // Make sure not to accidentally collide with own pid. |
47 do { | 48 do { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 143 |
143 // Flush the task(s). | 144 // Flush the task(s). |
144 test_task_runner_->RunPendingTasks(); | 145 test_task_runner_->RunPendingTasks(); |
145 | 146 |
146 // Make sure the subkey for the pseudo process has been deleted on reporting. | 147 // Make sure the subkey for the pseudo process has been deleted on reporting. |
147 ASSERT_EQ(ERROR_FILE_NOT_FOUND, | 148 ASSERT_EQ(ERROR_FILE_NOT_FOUND, |
148 key.Open(HKEY_CURRENT_USER, kRegistryPath, KEY_READ)); | 149 key.Open(HKEY_CURRENT_USER, kRegistryPath, KEY_READ)); |
149 } | 150 } |
150 | 151 |
151 } // namespace browser_watcher | 152 } // namespace browser_watcher |
OLD | NEW |