OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/browser/safe_browsing/srt_fetcher_win.h" | 5 #include "chrome/browser/safe_browsing/srt_fetcher_win.h" |
6 | 6 |
7 #include <initializer_list> | 7 #include <initializer_list> |
8 #include <iterator> | 8 #include <iterator> |
joenotcharles
2017/04/06 17:57:15
No longer needed (was used for std::begin / std::e
ftirelo
2017/04/06 20:41:47
Done.
| |
9 #include <set> | 9 #include <set> |
10 #include <utility> | |
10 #include <vector> | 11 #include <vector> |
11 | 12 |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
14 #include "base/callback.h" | 15 #include "base/callback.h" |
16 #include "base/callback_helpers.h" | |
15 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
16 #include "base/memory/ref_counted.h" | 18 #include "base/memory/ref_counted.h" |
17 #include "base/message_loop/message_loop.h" | 19 #include "base/message_loop/message_loop.h" |
20 #include "base/run_loop.h" | |
21 #include "base/strings/string_number_conversions.h" | |
22 #include "base/test/multiprocess_test.h" | |
18 #include "base/test/scoped_feature_list.h" | 23 #include "base/test/scoped_feature_list.h" |
19 #include "base/test/test_mock_time_task_runner.h" | 24 #include "base/test/test_mock_time_task_runner.h" |
25 #include "base/threading/sequenced_task_runner_handle.h" | |
20 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
21 #include "base/time/time.h" | 27 #include "base/time/time.h" |
22 #include "base/version.h" | 28 #include "base/version.h" |
23 #include "chrome/browser/browser_process.h" | 29 #include "chrome/browser/browser_process.h" |
24 #include "chrome/browser/lifetime/keep_alive_types.h" | 30 #include "chrome/browser/lifetime/keep_alive_types.h" |
25 #include "chrome/browser/lifetime/scoped_keep_alive.h" | 31 #include "chrome/browser/lifetime/scoped_keep_alive.h" |
26 #include "chrome/browser/profiles/profile.h" | 32 #include "chrome/browser/profiles/profile.h" |
27 #include "chrome/browser/safe_browsing/srt_client_info_win.h" | 33 #include "chrome/browser/safe_browsing/srt_client_info_win.h" |
28 #include "chrome/browser/ui/browser.h" | 34 #include "chrome/browser/ui/browser.h" |
29 #include "chrome/browser/ui/browser_finder.h" | 35 #include "chrome/browser/ui/browser_finder.h" |
30 #include "chrome/browser/ui/test/test_browser_dialog.h" | 36 #include "chrome/browser/ui/test/test_browser_dialog.h" |
31 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
32 #include "chrome/test/base/in_process_browser_test.h" | 38 #include "chrome/test/base/in_process_browser_test.h" |
39 #include "components/chrome_cleaner/public/interfaces/chrome_prompt.mojom.h" | |
33 #include "components/component_updater/pref_names.h" | 40 #include "components/component_updater/pref_names.h" |
34 #include "components/prefs/pref_service.h" | 41 #include "components/prefs/pref_service.h" |
35 #include "components/safe_browsing_db/safe_browsing_prefs.h" | 42 #include "components/safe_browsing_db/safe_browsing_prefs.h" |
43 #include "mojo/edk/embedder/embedder.h" | |
44 #include "mojo/edk/embedder/scoped_ipc_support.h" | |
45 #include "mojo/edk/system/core.h" | |
46 #include "testing/multiprocess_func_list.h" | |
36 | 47 |
37 namespace safe_browsing { | 48 namespace safe_browsing { |
38 | 49 |
39 namespace { | 50 namespace { |
40 | 51 |
41 const char* const kExpectedSwitches[] = {kExtendedSafeBrowsingEnabledSwitch, | 52 using chrome_cleaner::mojom::PromptAcceptance; |
42 kChromeVersionSwitch, | |
43 kChromeChannelSwitch}; | |
44 | 53 |
45 class SRTFetcherTest : public InProcessBrowserTest, | 54 // Special switches passed by the parent process (test case) to the reporter |
46 public SwReporterTestingDelegate { | 55 // child process to indicate the behavior that should be mocked. |
56 constexpr char kExitCodeToReturnSwitch[] = "exit-code-to-return"; | |
57 constexpr char kReportUwSFoundSwitch[] = "report-uws-found"; | |
58 constexpr char kReportElevationRequiredSwitch[] = "report-elevation-required"; | |
59 constexpr char kExpectedPromptAcceptanceSwitch[] = "expected-prompt-acceptance"; | |
60 | |
61 // The exit code to be returned in case of failure in the child process. | |
62 // This should never passed as the expected exit code to be report by tests. | |
joenotcharles
2017/04/06 17:57:14
Typo: "reported"
ftirelo
2017/04/06 20:41:47
Done.
| |
63 constexpr int kFailureExitCode = -1; | |
64 | |
65 // Pass the |prompt_acceptance| to the mock child process in command line | |
66 // switch kExpectedPromptAcceptanceSwitch. | |
67 void AddPromptAcceptanceToCommandLine(PromptAcceptance prompt_acceptance, | |
68 base::CommandLine* command_line) { | |
69 command_line->AppendSwitchASCII( | |
70 kExpectedPromptAcceptanceSwitch, | |
71 base::IntToString(static_cast<int>(prompt_acceptance))); | |
72 } | |
73 | |
74 // Parses and returns the prompt acceptance value passed by the parent process | |
75 // in command line switch kExpectedPromptAcceptanceSwitch. Returns | |
76 // PromptAcceptance::UNSPECIFIED if the switch doesn't exist or can't be | |
77 // parsed to a valid PromptAcceptance enumerator. | |
78 PromptAcceptance PromptAcceptanceFromCommandLine( | |
79 const base::CommandLine& command_line) { | |
80 const std::string& prompt_acceptance_str = | |
81 command_line.GetSwitchValueASCII(kExpectedPromptAcceptanceSwitch); | |
82 int val = -1; | |
83 if (base::StringToInt(prompt_acceptance_str, &val)) { | |
84 PromptAcceptance prompt_acceptance = static_cast<PromptAcceptance>(val); | |
85 if (chrome_cleaner::mojom::IsKnownEnumValue(prompt_acceptance)) | |
86 return prompt_acceptance; | |
87 } | |
88 return PromptAcceptance::UNSPECIFIED; | |
89 } | |
90 | |
91 // Pointer to ChromePromptPtr object to be used by the child process. The | |
92 // object must be created, deleted, and accessed on the IPC thread only. | |
93 chrome_cleaner::mojom::ChromePromptPtr* g_chrome_prompt_ptr = nullptr; | |
94 | |
95 // The callback function to be passed to ChromePrompt::PromptUser to check if | |
96 // the prompt accepted returned by the parent process is equals to | |
97 // |expected_prompt_acceptance|. Will set |expected_value_received| with the | |
98 // comparison result, so that the main thread can report failure. Will invoke | |
99 // |done| callback when done. | |
100 void PromptUserCallback(const base::Closure& done, | |
101 PromptAcceptance expected_prompt_acceptance, | |
102 bool* expected_value_received, | |
103 PromptAcceptance prompt_acceptance) { | |
104 *expected_value_received = prompt_acceptance == expected_prompt_acceptance; | |
105 // It's safe to delete the ChromePromptPtr object here, since it will not be | |
106 // used anymore by the child process. | |
107 delete g_chrome_prompt_ptr; | |
108 done.Run(); | |
109 } | |
110 | |
111 // Mocks the sending of scan results from the child process to the parent | |
112 // process. Obtains the behavior to be mocked from special switches in | |
113 // |command_line| sets |expected_value_received| as true if the parent | |
joenotcharles
2017/04/06 17:57:15
I think "sets" should start a new sentence.
ftirelo
2017/04/06 20:41:47
Done.
| |
114 // process replies with the expected prompt acceptance value. | |
115 void SendScanResults(const std::string& chrome_mojo_pipe_token, | |
116 const base::CommandLine& command_line, | |
117 const base::Closure& done, | |
118 bool* expected_value_received) { | |
119 constexpr int kDefaultUwSId = 10; | |
120 constexpr char kDefaultUwSName[] = "RemovedUwS"; | |
121 | |
122 mojo::ScopedMessagePipeHandle message_pipe_handle = | |
123 mojo::edk::CreateChildMessagePipe(chrome_mojo_pipe_token); | |
124 // This pointer will be deleted by callback |done|. | |
joenotcharles
2017/04/06 17:57:14
That's not exactly true, it's deleted by PromptUse
ftirelo
2017/04/06 20:41:47
Done.
| |
125 g_chrome_prompt_ptr = new chrome_cleaner::mojom::ChromePromptPtr(); | |
126 g_chrome_prompt_ptr->Bind(chrome_cleaner::mojom::ChromePromptPtrInfo( | |
127 std::move(message_pipe_handle), 0)); | |
128 | |
129 std::vector<chrome_cleaner::mojom::UwSPtr> removable_uws_found; | |
130 if (command_line.HasSwitch(kReportUwSFoundSwitch)) { | |
131 chrome_cleaner::mojom::UwSPtr uws = chrome_cleaner::mojom::UwS::New(); | |
132 uws->id = kDefaultUwSId; | |
133 uws->name = kDefaultUwSName; | |
134 uws->observed_behaviours = chrome_cleaner::mojom::ObservedBehaviours::New(); | |
135 removable_uws_found.push_back(std::move(uws)); | |
136 } | |
137 const bool elevation_required = | |
138 command_line.HasSwitch(kReportElevationRequiredSwitch); | |
139 const PromptAcceptance expected_prompt_acceptance = | |
140 PromptAcceptanceFromCommandLine(command_line); | |
141 | |
142 (*g_chrome_prompt_ptr) | |
143 ->PromptUser( | |
144 std::move(removable_uws_found), elevation_required, | |
145 base::Bind(&PromptUserCallback, done, expected_prompt_acceptance, | |
146 expected_value_received)); | |
147 } | |
148 | |
149 // Connects to the parent process and send mocked scan results. Returns true if | |
150 // connection was successful and the prompt acceptance results sent by the | |
151 // parent process are the same as expected. | |
152 bool ConnectAndSendDataToParentProcess(const base::CommandLine& command_line) { | |
153 mojo::edk::Init(); | |
154 base::Thread::Options options(base::MessageLoop::TYPE_IO, 0); | |
155 base::Thread io_thread("IPCThread"); | |
156 if (!io_thread.StartWithOptions(options)) | |
157 return false; | |
158 mojo::edk::ScopedIPCSupport ipc_support( | |
159 io_thread.task_runner(), | |
160 mojo::edk::ScopedIPCSupport::ShutdownPolicy::CLEAN); | |
161 mojo::edk::SetParentPipeHandleFromCommandLine(); | |
162 const std::string& chrome_mojo_pipe_token = | |
163 command_line.GetSwitchValueASCII(kChromeMojoPipeTokenSwitch); | |
164 if (chrome_mojo_pipe_token.empty()) | |
165 return false; | |
166 | |
167 base::MessageLoop message_loop; | |
168 base::RunLoop run_loop; | |
169 // After the response from the parent process is received, this will post a | |
170 // task to unblock the child's process main thread. | |
171 auto done = base::Bind( | |
172 [](scoped_refptr<base::SequencedTaskRunner> main_runner, | |
173 base::Closure quit_closure) { | |
174 main_runner->PostTask(FROM_HERE, std::move(quit_closure)); | |
175 }, | |
176 base::SequencedTaskRunnerHandle::Get(), | |
177 base::Passed(run_loop.QuitClosure())); | |
178 | |
179 bool expected_value_received = false; | |
180 io_thread.task_runner()->PostTask( | |
181 FROM_HERE, base::Bind(&SendScanResults, chrome_mojo_pipe_token, | |
182 command_line, done, &expected_value_received)); | |
183 run_loop.Run(); | |
184 | |
185 return expected_value_received; | |
186 } | |
187 | |
188 // Mocks a Software Reporter process that returns an exit code specified by | |
189 // command line switch kExitCodeToReturnSwitch. If a Mojo IPC is available, | |
190 // this will also connect to the parent process and send mocked scan results | |
191 // to the parent process using data passed as command line switches. | |
192 MULTIPROCESS_TEST_MAIN(MockSwReporterProcess) { | |
193 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | |
194 const std::string& str = | |
195 command_line->GetSwitchValueASCII(kExitCodeToReturnSwitch); | |
196 int exit_code_to_report = kFailureExitCode; | |
197 bool success = base::StringToInt(str, &exit_code_to_report) && | |
198 (!command_line->HasSwitch(kChromeMojoPipeTokenSwitch) || | |
joenotcharles
2017/04/06 17:57:14
Nit: I think it'd be cleaner to read chrome_mojo_p
ftirelo
2017/04/06 20:41:47
Done.
| |
199 ConnectAndSendDataToParentProcess(*command_line)); | |
200 return success ? exit_code_to_report : kFailureExitCode; | |
201 } | |
202 | |
203 // Parameters for this test: | |
204 // - bool in_browser_cleaner_ui: indicates if InBrowserCleanerUI experiment | |
205 // is enabled; if so, the parent and the child processes will communicate | |
206 // via a Mojo IPC; | |
207 // - bool elevation_required: indicates if the scan results sent by the child | |
208 // process should consider that elevation will be required for cleanup. | |
209 class SRTFetcherTest | |
210 : public InProcessBrowserTest, | |
211 public SwReporterTestingDelegate, | |
212 public ::testing::WithParamInterface<std::tuple<bool, bool>> { | |
joenotcharles
2017/04/06 17:57:14
Please include <tuple> for this.
ftirelo
2017/04/06 20:41:47
Done.
| |
47 public: | 213 public: |
48 void SetUpInProcessBrowserTestFixture() override { | 214 void SetUpInProcessBrowserTestFixture() override { |
49 SetSwReporterTestingDelegate(this); | 215 SetSwReporterTestingDelegate(this); |
50 } | 216 } |
51 | 217 |
52 void SetUpOnMainThread() override { | 218 void SetUpOnMainThread() override { |
53 // During the test, use a task runner with a mock clock. | 219 // During the test, use a task runner with a mock clock. |
54 saved_task_runner_ = base::ThreadTaskRunnerHandle::Get(); | 220 saved_task_runner_ = base::ThreadTaskRunnerHandle::Get(); |
55 ASSERT_NE(mock_time_task_runner_, saved_task_runner_); | 221 ASSERT_NE(mock_time_task_runner_, saved_task_runner_); |
56 base::MessageLoop::current()->SetTaskRunner(mock_time_task_runner_); | 222 base::MessageLoop::current()->SetTaskRunner(mock_time_task_runner_); |
57 | 223 |
58 InProcessBrowserTest::SetUpOnMainThread(); | 224 InProcessBrowserTest::SetUpOnMainThread(); |
59 | 225 |
60 // SetDateInLocalState calculates a time as Now() minus an offset. Move the | 226 // SetDateInLocalState calculates a time as Now() minus an offset. Move the |
61 // simulated clock ahead far enough that this calculation won't underflow. | 227 // simulated clock ahead far enough that this calculation won't underflow. |
62 mock_time_task_runner_->FastForwardBy( | 228 mock_time_task_runner_->FastForwardBy( |
63 base::TimeDelta::FromDays(kDaysBetweenSuccessfulSwReporterRuns * 2)); | 229 base::TimeDelta::FromDays(kDaysBetweenSuccessfulSwReporterRuns * 2)); |
64 | 230 |
65 ClearLastTimeSentReport(); | 231 ClearLastTimeSentReport(); |
232 | |
233 std::tie(in_browser_cleaner_ui_, elevation_required_) = GetParam(); | |
234 // The config should only accept elevation_required_ if InBrowserCleanerUI | |
235 // feature is enabled. | |
236 ASSERT_TRUE(!elevation_required_ || in_browser_cleaner_ui_); | |
66 } | 237 } |
67 | 238 |
68 void TearDownOnMainThread() override { | 239 void TearDownOnMainThread() override { |
69 // Restore the standard task runner to perform browser cleanup, which will | 240 // Restore the standard task runner to perform browser cleanup, which will |
70 // wait forever with the mock clock. | 241 // wait forever with the mock clock. |
71 base::MessageLoop::current()->SetTaskRunner(saved_task_runner_); | 242 base::MessageLoop::current()->SetTaskRunner(saved_task_runner_); |
72 } | 243 } |
73 | 244 |
74 void TearDownInProcessBrowserTestFixture() override { | 245 void TearDownInProcessBrowserTestFixture() override { |
75 SetSwReporterTestingDelegate(nullptr); | 246 SetSwReporterTestingDelegate(nullptr); |
76 } | 247 } |
77 | 248 |
78 // Records that the prompt was shown. | 249 // Records that the prompt was shown. |
79 void TriggerPrompt(Browser* browser, const std::string& version) override { | 250 void TriggerPrompt(Browser* browser, const std::string& version) override { |
80 prompt_trigger_called_ = true; | 251 prompt_trigger_called_ = true; |
81 } | 252 } |
82 | 253 |
83 // Records that the reporter was launched with the parameters given in | 254 // Spawns and returns a subprocess to mock an execution of the reporter with |
84 // |invocation|. | 255 // the parameters given in |invocation| and that will return |
85 int LaunchReporter(const SwReporterInvocation& invocation) override { | 256 // |exit_code_to_report_|. If IPC communication needs to be mocked, this will |
257 // also provide values that define the expected behavior of the child | |
258 // process. | |
259 // Records the launch and parameters used for further verification. | |
260 base::Process LaunchReporter( | |
261 const SwReporterInvocation& invocation, | |
262 const base::LaunchOptions& launch_options) override { | |
86 ++reporter_launch_count_; | 263 ++reporter_launch_count_; |
87 reporter_launch_parameters_.push_back(invocation); | 264 reporter_launch_parameters_.push_back(invocation); |
88 if (first_launch_callback_) | 265 if (first_launch_callback_) |
89 std::move(first_launch_callback_).Run(); | 266 std::move(first_launch_callback_).Run(); |
90 return exit_code_to_report_; | 267 |
268 base::CommandLine command_line( | |
269 base::GetMultiProcessTestChildBaseCommandLine()); | |
270 command_line.AppendArguments(invocation.command_line, | |
271 /*include_program=*/false); | |
272 command_line.AppendSwitchASCII(kExitCodeToReturnSwitch, | |
273 base::IntToString(exit_code_to_report_)); | |
274 if (in_browser_cleaner_ui_) { | |
275 AddPromptAcceptanceToCommandLine(PromptAcceptance::DENIED, &command_line); | |
276 if (exit_code_to_report_ == kSwReporterCleanupNeeded) { | |
277 command_line.AppendSwitch(kReportUwSFoundSwitch); | |
278 if (elevation_required_) | |
279 command_line.AppendSwitch(kReportElevationRequiredSwitch); | |
280 } | |
281 } | |
282 base::SpawnChildResult result = base::SpawnMultiProcessTestChild( | |
283 "MockSwReporterProcess", command_line, launch_options); | |
284 return std::move(result.process); | |
91 } | 285 } |
92 | 286 |
93 // Returns the test's idea of the current time. | 287 // Returns the test's idea of the current time. |
94 base::Time Now() const override { return mock_time_task_runner_->Now(); } | 288 base::Time Now() const override { return mock_time_task_runner_->Now(); } |
95 | 289 |
96 // Returns a task runner to use when launching the reporter (which is | 290 // Returns a task runner to use when launching the reporter (which is |
97 // normally a blocking action). | 291 // normally a blocking action). |
98 base::TaskRunner* BlockingTaskRunner() const override { | 292 base::TaskRunner* BlockingTaskRunner() const override { |
99 // Use the test's main task runner so that we don't need to pump another | 293 // Use the test's main task runner so that we don't need to pump another |
100 // message loop. Since the test calls LaunchReporter instead of actually | 294 // message loop. Since the test calls LaunchReporter instead of actually |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
227 // Checks if the last time sent logs is set as no more than one hour ago, | 421 // Checks if the last time sent logs is set as no more than one hour ago, |
228 // which should be enough time if the execution does not fail. | 422 // which should be enough time if the execution does not fail. |
229 EXPECT_LT(now - base::TimeDelta::FromHours(1), last_time_sent_logs); | 423 EXPECT_LT(now - base::TimeDelta::FromHours(1), last_time_sent_logs); |
230 EXPECT_GE(now, last_time_sent_logs); | 424 EXPECT_GE(now, last_time_sent_logs); |
231 } | 425 } |
232 | 426 |
233 // Expects |invocation|'s command line to contain all the switches required | 427 // Expects |invocation|'s command line to contain all the switches required |
234 // for reporter logging. | 428 // for reporter logging. |
235 void ExpectLoggingSwitches(const SwReporterInvocation& invocation, | 429 void ExpectLoggingSwitches(const SwReporterInvocation& invocation, |
236 bool expect_switches) { | 430 bool expect_switches) { |
431 static const std::set<std::string> logging_switches{ | |
432 kExtendedSafeBrowsingEnabledSwitch, kChromeVersionSwitch, | |
433 kChromeChannelSwitch}; | |
434 | |
237 const base::CommandLine::SwitchMap& invocation_switches = | 435 const base::CommandLine::SwitchMap& invocation_switches = |
238 invocation.command_line.GetSwitches(); | 436 invocation.command_line.GetSwitches(); |
239 std::set<std::string> expected_switches; | |
240 if (expect_switches) | |
241 expected_switches = {std::begin(kExpectedSwitches), | |
242 std::end(kExpectedSwitches)}; | |
243 EXPECT_EQ(expected_switches.size(), invocation_switches.size()); | |
244 // Checks if all expected switches are in the invocation switches. It's not | 437 // Checks if all expected switches are in the invocation switches. It's not |
245 // necessary to check if all invocation switches are expected, since we | 438 // necessary to check if all invocation switches are expected, since we |
246 // checked if both sets should have the same size. | 439 // checked if both sets should have the same size. |
joenotcharles
2017/04/06 17:57:15
This comment doesn't match the code anymore.
ftirelo
2017/04/06 20:41:47
Done.
| |
247 for (const std::string& expected_switch : expected_switches) { | 440 for (const std::string& logging_switch : logging_switches) { |
248 EXPECT_NE(invocation_switches.end(), | 441 EXPECT_EQ(expect_switches, invocation_switches.find(logging_switch) != |
249 invocation_switches.find(expected_switch)); | 442 invocation_switches.end()); |
250 } | 443 } |
251 } | 444 } |
252 | 445 |
446 std::unique_ptr<base::test::ScopedFeatureList> GetScopedFeatureList() { | |
447 std::unique_ptr<base::test::ScopedFeatureList> scoped_feature_list; | |
448 scoped_feature_list.reset(new base::test::ScopedFeatureList()); | |
joenotcharles
2017/04/06 17:57:15
Prefer "auto scoped_feature_list = base::MakeUniqu
ftirelo
2017/04/06 20:41:47
Not a unique_ptr anymore.
| |
449 if (in_browser_cleaner_ui_) | |
450 scoped_feature_list->InitAndEnableFeature(kInBrowserCleanerUIFeature); | |
451 else | |
452 scoped_feature_list->InitAndDisableFeature(kInBrowserCleanerUIFeature); | |
453 return scoped_feature_list; | |
454 } | |
455 | |
253 // A task runner with a mock clock. | 456 // A task runner with a mock clock. |
254 scoped_refptr<base::TestMockTimeTaskRunner> mock_time_task_runner_ = | 457 scoped_refptr<base::TestMockTimeTaskRunner> mock_time_task_runner_ = |
255 new base::TestMockTimeTaskRunner(); | 458 new base::TestMockTimeTaskRunner(); |
256 | 459 |
257 // The task runner that was in use before installing |mock_time_task_runner_|. | 460 // The task runner that was in use before installing |mock_time_task_runner_|. |
258 scoped_refptr<base::SingleThreadTaskRunner> saved_task_runner_; | 461 scoped_refptr<base::SingleThreadTaskRunner> saved_task_runner_; |
259 | 462 |
463 bool in_browser_cleaner_ui_; | |
464 bool elevation_required_; | |
465 | |
260 bool prompt_trigger_called_ = false; | 466 bool prompt_trigger_called_ = false; |
261 int reporter_launch_count_ = 0; | 467 int reporter_launch_count_ = 0; |
262 std::vector<SwReporterInvocation> reporter_launch_parameters_; | 468 std::vector<SwReporterInvocation> reporter_launch_parameters_; |
263 int exit_code_to_report_ = kReporterFailureExitCode; | 469 int exit_code_to_report_ = kReporterFailureExitCode; |
264 | 470 |
265 // A callback to invoke when the first reporter of a queue is launched. This | 471 // A callback to invoke when the first reporter of a queue is launched. This |
266 // can be used to perform actions in the middle of a queue of reporters which | 472 // can be used to perform actions in the middle of a queue of reporters which |
267 // all launch on the same mock clock tick. | 473 // all launch on the same mock clock tick. |
268 base::OnceClosure first_launch_callback_; | 474 base::OnceClosure first_launch_callback_; |
269 }; | 475 }; |
270 | 476 |
271 class SRTFetcherPromptTest : public DialogBrowserTest { | 477 class SRTFetcherPromptTest : public DialogBrowserTest { |
272 public: | 478 public: |
273 void ShowDialog(const std::string& name) override { | 479 void ShowDialog(const std::string& name) override { |
274 if (name == "SRTErrorNoFile") | 480 if (name == "SRTErrorNoFile") |
275 DisplaySRTPromptForTesting(base::FilePath()); | 481 DisplaySRTPromptForTesting(base::FilePath()); |
276 else if (name == "SRTErrorFile") | 482 else if (name == "SRTErrorFile") |
277 DisplaySRTPromptForTesting( | 483 DisplaySRTPromptForTesting( |
278 base::FilePath().Append(FILE_PATH_LITERAL("c:\temp\testfile.txt"))); | 484 base::FilePath().Append(FILE_PATH_LITERAL("c:\temp\testfile.txt"))); |
279 else | 485 else |
280 ADD_FAILURE() << "Unknown dialog type."; | 486 ADD_FAILURE() << "Unknown dialog type."; |
281 } | 487 } |
282 }; | 488 }; |
283 | 489 |
284 } // namespace | 490 } // namespace |
285 | 491 |
286 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, NothingFound) { | 492 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, NothingFound) { |
493 auto scoped_feature_list = GetScopedFeatureList(); | |
joenotcharles
2017/04/06 17:57:14
Instead of putting this at the start of every test
ftirelo
2017/04/06 20:41:47
Done.
| |
494 | |
287 RunReporter(kSwReporterNothingFound); | 495 RunReporter(kSwReporterNothingFound); |
288 ExpectReporterLaunches(0, 1, false); | 496 ExpectReporterLaunches(0, 1, false); |
289 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 497 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
290 } | 498 } |
291 | 499 |
292 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, CleanupNeeded) { | 500 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, CleanupNeeded) { |
501 auto scoped_feature_list = GetScopedFeatureList(); | |
502 | |
293 RunReporter(kSwReporterCleanupNeeded); | 503 RunReporter(kSwReporterCleanupNeeded); |
294 ExpectReporterLaunches(0, 1, true); | 504 ExpectReporterLaunches(0, 1, true); |
295 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 505 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
296 } | 506 } |
297 | 507 |
298 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, RanRecently) { | 508 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, RanRecently) { |
509 auto scoped_feature_list = GetScopedFeatureList(); | |
510 | |
299 constexpr int kDaysLeft = 1; | 511 constexpr int kDaysLeft = 1; |
300 SetDaysSinceLastTriggered(kDaysBetweenSuccessfulSwReporterRuns - kDaysLeft); | 512 SetDaysSinceLastTriggered(kDaysBetweenSuccessfulSwReporterRuns - kDaysLeft); |
301 RunReporter(kSwReporterNothingFound); | 513 RunReporter(kSwReporterNothingFound); |
302 ExpectReporterLaunches(0, 0, false); | 514 ExpectReporterLaunches(0, 0, false); |
303 ExpectToRunAgain(kDaysLeft); | 515 ExpectToRunAgain(kDaysLeft); |
304 ExpectReporterLaunches(kDaysLeft, 1, false); | 516 ExpectReporterLaunches(kDaysLeft, 1, false); |
305 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 517 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
306 } | 518 } |
307 | 519 |
308 // Test is flaky. crbug.com/705608 | 520 // Test is flaky. crbug.com/705608 |
309 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, DISABLED_WaitForBrowser) { | 521 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, DISABLED_WaitForBrowser) { |
522 auto scoped_feature_list = GetScopedFeatureList(); | |
523 | |
310 Profile* profile = browser()->profile(); | 524 Profile* profile = browser()->profile(); |
311 | 525 |
312 // Ensure that even though we're closing the last browser, we don't enter the | 526 // Ensure that even though we're closing the last browser, we don't enter the |
313 // "shutting down" state, which will prevent the test from starting another | 527 // "shutting down" state, which will prevent the test from starting another |
314 // browser. | 528 // browser. |
315 ScopedKeepAlive test_keep_alive(KeepAliveOrigin::SESSION_RESTORE, | 529 ScopedKeepAlive test_keep_alive(KeepAliveOrigin::SESSION_RESTORE, |
316 KeepAliveRestartOption::ENABLED); | 530 KeepAliveRestartOption::ENABLED); |
317 | 531 |
318 // Use the standard task runner for browser cleanup, which will wait forever | 532 // Use the standard task runner for browser cleanup, which will wait forever |
319 // with the mock clock. | 533 // with the mock clock. |
(...skipping 19 matching lines...) Expand all Loading... | |
339 // pending task in the queue is the next reporter check. | 553 // pending task in the queue is the next reporter check. |
340 mock_time_task_runner_->FastForwardBy(base::TimeDelta::FromMinutes(10)); | 554 mock_time_task_runner_->FastForwardBy(base::TimeDelta::FromMinutes(10)); |
341 | 555 |
342 // On opening the new browser, the prompt should be shown and the reporter | 556 // On opening the new browser, the prompt should be shown and the reporter |
343 // should be scheduled to run later. | 557 // should be scheduled to run later. |
344 EXPECT_EQ(1, reporter_launch_count_); | 558 EXPECT_EQ(1, reporter_launch_count_); |
345 EXPECT_TRUE(prompt_trigger_called_); | 559 EXPECT_TRUE(prompt_trigger_called_); |
346 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 560 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
347 } | 561 } |
348 | 562 |
349 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, Failure) { | 563 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, Failure) { |
564 auto scoped_feature_list = GetScopedFeatureList(); | |
565 | |
350 RunReporter(kReporterFailureExitCode); | 566 RunReporter(kReporterFailureExitCode); |
351 ExpectReporterLaunches(0, 1, false); | 567 ExpectReporterLaunches(0, 1, false); |
352 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 568 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
353 } | 569 } |
354 | 570 |
355 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, RunDaily) { | 571 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, RunDaily) { |
572 auto scoped_feature_list = GetScopedFeatureList(); | |
573 | |
356 PrefService* local_state = g_browser_process->local_state(); | 574 PrefService* local_state = g_browser_process->local_state(); |
357 local_state->SetBoolean(prefs::kSwReporterPendingPrompt, true); | 575 local_state->SetBoolean(prefs::kSwReporterPendingPrompt, true); |
358 SetDaysSinceLastTriggered(kDaysBetweenSuccessfulSwReporterRuns - 1); | 576 SetDaysSinceLastTriggered(kDaysBetweenSuccessfulSwReporterRuns - 1); |
359 ASSERT_GT(kDaysBetweenSuccessfulSwReporterRuns - 1, | 577 ASSERT_GT(kDaysBetweenSuccessfulSwReporterRuns - 1, |
360 kDaysBetweenSwReporterRunsForPendingPrompt); | 578 kDaysBetweenSwReporterRunsForPendingPrompt); |
361 RunReporter(kSwReporterNothingFound); | 579 RunReporter(kSwReporterNothingFound); |
362 | 580 |
363 // Expect the reporter to run immediately, since a prompt is pending and it | 581 // Expect the reporter to run immediately, since a prompt is pending and it |
364 // has been more than kDaysBetweenSwReporterRunsForPendingPrompt days. | 582 // has been more than kDaysBetweenSwReporterRunsForPendingPrompt days. |
365 ExpectReporterLaunches(0, 1, false); | 583 ExpectReporterLaunches(0, 1, false); |
366 ExpectToRunAgain(kDaysBetweenSwReporterRunsForPendingPrompt); | 584 ExpectToRunAgain(kDaysBetweenSwReporterRunsForPendingPrompt); |
367 | 585 |
368 // Move the clock ahead kDaysBetweenSwReporterRunsForPendingPrompt days. The | 586 // Move the clock ahead kDaysBetweenSwReporterRunsForPendingPrompt days. The |
369 // expected run should trigger, but not cause the reporter to launch because | 587 // expected run should trigger, but not cause the reporter to launch because |
370 // a prompt is no longer pending. | 588 // a prompt is no longer pending. |
371 local_state->SetBoolean(prefs::kSwReporterPendingPrompt, false); | 589 local_state->SetBoolean(prefs::kSwReporterPendingPrompt, false); |
372 ExpectReporterLaunches(kDaysBetweenSwReporterRunsForPendingPrompt, 0, false); | 590 ExpectReporterLaunches(kDaysBetweenSwReporterRunsForPendingPrompt, 0, false); |
373 | 591 |
374 // Instead it should now run kDaysBetweenSuccessfulSwReporterRuns after the | 592 // Instead it should now run kDaysBetweenSuccessfulSwReporterRuns after the |
375 // first prompt (of which kDaysBetweenSwReporterRunsForPendingPrompt has | 593 // first prompt (of which kDaysBetweenSwReporterRunsForPendingPrompt has |
376 // already passed.) | 594 // already passed.) |
377 int days_left = kDaysBetweenSuccessfulSwReporterRuns - | 595 int days_left = kDaysBetweenSuccessfulSwReporterRuns - |
378 kDaysBetweenSwReporterRunsForPendingPrompt; | 596 kDaysBetweenSwReporterRunsForPendingPrompt; |
379 ExpectToRunAgain(days_left); | 597 ExpectToRunAgain(days_left); |
380 ExpectReporterLaunches(days_left, 1, false); | 598 ExpectReporterLaunches(days_left, 1, false); |
381 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 599 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
382 } | 600 } |
383 | 601 |
384 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ParameterChange) { | 602 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, ParameterChange) { |
603 auto scoped_feature_list = GetScopedFeatureList(); | |
604 | |
385 // If the reporter is run several times with different parameters, it should | 605 // If the reporter is run several times with different parameters, it should |
386 // only be launched once, with the last parameter set. | 606 // only be launched once, with the last parameter set. |
387 const base::FilePath path1(L"path1"); | 607 const base::FilePath path1(L"path1"); |
388 const base::FilePath path2(L"path2"); | 608 const base::FilePath path2(L"path2"); |
389 const base::FilePath path3(L"path3"); | 609 const base::FilePath path3(L"path3"); |
390 | 610 |
391 // Schedule path1 with a day left in the reporting period. | 611 // Schedule path1 with a day left in the reporting period. |
392 // The reporter should not launch. | 612 // The reporter should not launch. |
393 constexpr int kDaysLeft = 1; | 613 constexpr int kDaysLeft = 1; |
394 { | 614 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
431 { | 651 { |
432 SCOPED_TRACE("Run with same parameters"); | 652 SCOPED_TRACE("Run with same parameters"); |
433 RunReporter(kSwReporterNothingFound, path3); | 653 RunReporter(kSwReporterNothingFound, path3); |
434 ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path3}, | 654 ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path3}, |
435 false); | 655 false); |
436 } | 656 } |
437 | 657 |
438 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 658 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
439 } | 659 } |
440 | 660 |
441 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, MultipleLaunches) { | 661 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, MultipleLaunches) { |
662 auto scoped_feature_list = GetScopedFeatureList(); | |
663 | |
442 const base::FilePath path1(L"path1"); | 664 const base::FilePath path1(L"path1"); |
443 const base::FilePath path2(L"path2"); | 665 const base::FilePath path2(L"path2"); |
444 const base::FilePath path3(L"path3"); | 666 const base::FilePath path3(L"path3"); |
445 | 667 |
446 SwReporterQueue invocations; | 668 SwReporterQueue invocations; |
447 invocations.push(SwReporterInvocation::FromFilePath(path1)); | 669 invocations.push(SwReporterInvocation::FromFilePath(path1)); |
448 invocations.push(SwReporterInvocation::FromFilePath(path2)); | 670 invocations.push(SwReporterInvocation::FromFilePath(path2)); |
449 | 671 |
450 { | 672 { |
451 SCOPED_TRACE("Launch 2 times"); | 673 SCOPED_TRACE("Launch 2 times"); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
499 // anything. | 721 // anything. |
500 ExpectReporterLaunches(0, {}, false); | 722 ExpectReporterLaunches(0, {}, false); |
501 | 723 |
502 // After enough time has passed, should try the queue again. | 724 // After enough time has passed, should try the queue again. |
503 ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path1}, | 725 ExpectReporterLaunches(kDaysBetweenSuccessfulSwReporterRuns, {path1}, |
504 false); | 726 false); |
505 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 727 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
506 } | 728 } |
507 } | 729 } |
508 | 730 |
509 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_NoSBExtendedReporting) { | 731 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, ReporterLogging_NoSBExtendedReporting) { |
510 base::test::ScopedFeatureList scoped_feature_list; | 732 auto scoped_feature_list = GetScopedFeatureList(); |
733 | |
511 RunReporter(kSwReporterNothingFound); | 734 RunReporter(kSwReporterNothingFound); |
512 ExpectReporterLaunches(0, 1, false); | 735 ExpectReporterLaunches(0, 1, false); |
513 ExpectLoggingSwitches(reporter_launch_parameters_.front(), false); | 736 ExpectLoggingSwitches(reporter_launch_parameters_.front(), false); |
514 ExpectLastTimeSentReportNotSet(); | 737 ExpectLastTimeSentReportNotSet(); |
515 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 738 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
516 } | 739 } |
517 | 740 |
518 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_EnabledFirstRun) { | 741 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, ReporterLogging_EnabledFirstRun) { |
519 base::test::ScopedFeatureList scoped_feature_list; | 742 auto scoped_feature_list = GetScopedFeatureList(); |
743 | |
520 EnableSBExtendedReporting(); | 744 EnableSBExtendedReporting(); |
521 // Note: don't set last time sent logs in the local state. | 745 // Note: don't set last time sent logs in the local state. |
522 // SBER is enabled and there is no record in the local state of the last time | 746 // SBER is enabled and there is no record in the local state of the last time |
523 // logs have been sent, so we should send logs in this run. | 747 // logs have been sent, so we should send logs in this run. |
524 RunReporter(kSwReporterNothingFound); | 748 RunReporter(kSwReporterNothingFound); |
525 ExpectReporterLaunches(0, 1, false); | 749 ExpectReporterLaunches(0, 1, false); |
526 ExpectLoggingSwitches(reporter_launch_parameters_.front(), true); | 750 ExpectLoggingSwitches(reporter_launch_parameters_.front(), true); |
527 ExpectLastReportSentInTheLastHour(); | 751 ExpectLastReportSentInTheLastHour(); |
528 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 752 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
529 } | 753 } |
530 | 754 |
531 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_EnabledNoRecentLogging) { | 755 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, ReporterLogging_EnabledNoRecentLogging) { |
532 base::test::ScopedFeatureList scoped_feature_list; | 756 auto scoped_feature_list = GetScopedFeatureList(); |
757 | |
533 // SBER is enabled and last time logs were sent was more than | 758 // SBER is enabled and last time logs were sent was more than |
534 // |kDaysBetweenReporterLogsSent| day ago, so we should send logs in this run. | 759 // |kDaysBetweenReporterLogsSent| day ago, so we should send logs in this run. |
535 EnableSBExtendedReporting(); | 760 EnableSBExtendedReporting(); |
536 SetLastTimeSentReport(kDaysBetweenReporterLogsSent + 3); | 761 SetLastTimeSentReport(kDaysBetweenReporterLogsSent + 3); |
537 RunReporter(kSwReporterNothingFound); | 762 RunReporter(kSwReporterNothingFound); |
538 ExpectReporterLaunches(0, 1, false); | 763 ExpectReporterLaunches(0, 1, false); |
539 ExpectLoggingSwitches(reporter_launch_parameters_.front(), true); | 764 ExpectLoggingSwitches(reporter_launch_parameters_.front(), true); |
540 ExpectLastReportSentInTheLastHour(); | 765 ExpectLastReportSentInTheLastHour(); |
541 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 766 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
542 } | 767 } |
543 | 768 |
544 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_EnabledRecentlyLogged) { | 769 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, ReporterLogging_EnabledRecentlyLogged) { |
545 base::test::ScopedFeatureList scoped_feature_list; | 770 auto scoped_feature_list = GetScopedFeatureList(); |
771 | |
546 // SBER is enabled, but logs have been sent less than | 772 // SBER is enabled, but logs have been sent less than |
547 // |kDaysBetweenReporterLogsSent| day ago, so we shouldn't send any logs in | 773 // |kDaysBetweenReporterLogsSent| day ago, so we shouldn't send any logs in |
548 // this run. | 774 // this run. |
549 EnableSBExtendedReporting(); | 775 EnableSBExtendedReporting(); |
550 SetLastTimeSentReport(kDaysBetweenReporterLogsSent - 1); | 776 SetLastTimeSentReport(kDaysBetweenReporterLogsSent - 1); |
551 int64_t last_time_sent_logs = GetLastTimeSentReport(); | 777 int64_t last_time_sent_logs = GetLastTimeSentReport(); |
552 RunReporter(kSwReporterNothingFound); | 778 RunReporter(kSwReporterNothingFound); |
553 ExpectReporterLaunches(0, 1, false); | 779 ExpectReporterLaunches(0, 1, false); |
554 ExpectLoggingSwitches(reporter_launch_parameters_.front(), false); | 780 ExpectLoggingSwitches(reporter_launch_parameters_.front(), false); |
555 EXPECT_EQ(last_time_sent_logs, GetLastTimeSentReport()); | 781 EXPECT_EQ(last_time_sent_logs, GetLastTimeSentReport()); |
556 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 782 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
557 } | 783 } |
558 | 784 |
559 IN_PROC_BROWSER_TEST_F(SRTFetcherTest, ReporterLogging_MultipleLaunches) { | 785 IN_PROC_BROWSER_TEST_P(SRTFetcherTest, ReporterLogging_MultipleLaunches) { |
560 base::test::ScopedFeatureList scoped_feature_list; | 786 auto scoped_feature_list = GetScopedFeatureList(); |
787 | |
561 EnableSBExtendedReporting(); | 788 EnableSBExtendedReporting(); |
562 SetLastTimeSentReport(kDaysBetweenReporterLogsSent + 3); | 789 SetLastTimeSentReport(kDaysBetweenReporterLogsSent + 3); |
563 | 790 |
564 const base::FilePath path1(L"path1"); | 791 const base::FilePath path1(L"path1"); |
565 const base::FilePath path2(L"path2"); | 792 const base::FilePath path2(L"path2"); |
566 SwReporterQueue invocations; | 793 SwReporterQueue invocations; |
567 for (const auto& path : {path1, path2}) { | 794 for (const auto& path : {path1, path2}) { |
568 auto invocation = SwReporterInvocation::FromFilePath(path); | 795 auto invocation = SwReporterInvocation::FromFilePath(path); |
569 invocation.supported_behaviours = | 796 invocation.supported_behaviours = |
570 SwReporterInvocation::BEHAVIOUR_ALLOW_SEND_REPORTER_LOGS; | 797 SwReporterInvocation::BEHAVIOUR_ALLOW_SEND_REPORTER_LOGS; |
(...skipping 15 matching lines...) Expand all Loading... | |
586 // Logs should also be sent for the next run, even though LastTimeSentReport | 813 // Logs should also be sent for the next run, even though LastTimeSentReport |
587 // is now recent, because the run is part of the same set of invocations. | 814 // is now recent, because the run is part of the same set of invocations. |
588 { | 815 { |
589 SCOPED_TRACE("second launch"); | 816 SCOPED_TRACE("second launch"); |
590 ExpectLoggingSwitches(reporter_launch_parameters_[1], true); | 817 ExpectLoggingSwitches(reporter_launch_parameters_[1], true); |
591 ExpectLastReportSentInTheLastHour(); | 818 ExpectLastReportSentInTheLastHour(); |
592 } | 819 } |
593 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); | 820 ExpectToRunAgain(kDaysBetweenSuccessfulSwReporterRuns); |
594 } | 821 } |
595 | 822 |
823 INSTANTIATE_TEST_CASE_P(NoInBrowserCleanerUI, | |
824 SRTFetcherTest, | |
825 testing::Combine(testing::Values(false), | |
826 testing::Values(false))); | |
827 | |
828 INSTANTIATE_TEST_CASE_P(InBrowserCleanerUI, | |
829 SRTFetcherTest, | |
830 testing::Combine(testing::Values(true), | |
831 testing::Bool())); | |
832 | |
596 // This provide tests which allows explicit invocation of the SRT Prompt | 833 // This provide tests which allows explicit invocation of the SRT Prompt |
597 // useful for checking dialog layout or any other interactive functionality | 834 // useful for checking dialog layout or any other interactive functionality |
598 // tests. See docs/testing/test_browser_dialog.md for description of the | 835 // tests. See docs/testing/test_browser_dialog.md for description of the |
599 // testing framework. | 836 // testing framework. |
600 IN_PROC_BROWSER_TEST_F(SRTFetcherPromptTest, InvokeDialog_SRTErrorNoFile) { | 837 IN_PROC_BROWSER_TEST_F(SRTFetcherPromptTest, InvokeDialog_SRTErrorNoFile) { |
601 RunDialog(); | 838 RunDialog(); |
602 } | 839 } |
603 | 840 |
604 IN_PROC_BROWSER_TEST_F(SRTFetcherPromptTest, InvokeDialog_SRTErrorFile) { | 841 IN_PROC_BROWSER_TEST_F(SRTFetcherPromptTest, InvokeDialog_SRTErrorFile) { |
605 RunDialog(); | 842 RunDialog(); |
606 } | 843 } |
607 | 844 |
608 } // namespace safe_browsing | 845 } // namespace safe_browsing |
OLD | NEW |