OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/component_updater/sw_reporter_installer_win.h" | 5 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
11 #include <vector> | |
12 | 11 |
13 #include "base/bind.h" | 12 #include "base/bind.h" |
14 #include "base/bind_helpers.h" | 13 #include "base/bind_helpers.h" |
15 #include "base/command_line.h" | 14 #include "base/command_line.h" |
16 #include "base/feature_list.h" | 15 #include "base/feature_list.h" |
17 #include "base/files/file_path.h" | 16 #include "base/files/file_path.h" |
18 #include "base/json/json_reader.h" | 17 #include "base/json/json_reader.h" |
19 #include "base/macros.h" | 18 #include "base/macros.h" |
20 #include "base/metrics/field_trial.h" | 19 #include "base/metrics/field_trial.h" |
21 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
22 #include "base/test/histogram_tester.h" | 21 #include "base/test/histogram_tester.h" |
23 #include "base/test/scoped_feature_list.h" | 22 #include "base/test/scoped_feature_list.h" |
24 #include "base/values.h" | 23 #include "base/values.h" |
25 #include "base/version.h" | 24 #include "base/version.h" |
26 #include "chrome/browser/safe_browsing/srt_fetcher_win.h" | 25 #include "chrome/browser/safe_browsing/srt_fetcher_win.h" |
27 #include "components/variations/variations_associated_data.h" | 26 #include "components/variations/variations_associated_data.h" |
28 #include "content/public/test/test_browser_thread_bundle.h" | 27 #include "content/public/test/test_browser_thread_bundle.h" |
29 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
30 | 29 |
31 namespace component_updater { | 30 namespace component_updater { |
32 | 31 |
33 namespace { | 32 namespace { |
34 | 33 |
35 constexpr char kRegistrySuffixSwitch[] = "registry-suffix"; | 34 constexpr char kRegistrySuffixSwitch[] = "registry-suffix"; |
36 constexpr char kErrorHistogramName[] = "SoftwareReporter.ExperimentErrors"; | 35 constexpr char kErrorHistogramName[] = "SoftwareReporter.ExperimentErrors"; |
37 constexpr char kExperimentTag[] = "experiment_tag"; | 36 constexpr char kExperimentTag[] = "experiment_tag"; |
38 constexpr char kMissingTag[] = "missing_tag"; | 37 constexpr char kMissingTag[] = "missing_tag"; |
39 | 38 |
| 39 using safe_browsing::SwReporterInvocation; |
| 40 |
40 } // namespace | 41 } // namespace |
41 | 42 |
42 class SwReporterInstallerTest : public ::testing::Test { | 43 class SwReporterInstallerTest : public ::testing::Test { |
43 public: | 44 public: |
44 SwReporterInstallerTest() | 45 SwReporterInstallerTest() |
45 : launched_callback_( | 46 : launched_callback_( |
46 base::Bind(&SwReporterInstallerTest::SwReporterLaunched, | 47 base::Bind(&SwReporterInstallerTest::SwReporterLaunched, |
47 base::Unretained(this))), | 48 base::Unretained(this))), |
48 default_version_("1.2.3"), | 49 default_version_("1.2.3"), |
49 default_path_(L"C:\\full\\path\\to\\download") {} | 50 default_path_(L"C:\\full\\path\\to\\download"), |
| 51 launched_version_("0.0.0") {} |
50 | 52 |
51 ~SwReporterInstallerTest() override {} | 53 ~SwReporterInstallerTest() override {} |
52 | 54 |
53 protected: | 55 protected: |
54 void SwReporterLaunched(const safe_browsing::SwReporterInvocation& invocation, | 56 void SwReporterLaunched(const safe_browsing::SwReporterQueue& invocations, |
55 const base::Version& version) { | 57 const base::Version& version) { |
56 ASSERT_TRUE(launched_invocations_.empty()); | 58 ASSERT_TRUE(launched_invocations_.empty()); |
57 launched_invocations_.push_back(invocation); | 59 launched_invocations_ = invocations; |
58 launched_version_ = version; | 60 launched_version_ = version; |
59 } | 61 } |
60 | 62 |
61 base::FilePath MakeTestFilePath(const base::FilePath& path) const { | 63 base::FilePath MakeTestFilePath(const base::FilePath& path) const { |
62 return path.Append(L"software_reporter_tool.exe"); | 64 return path.Append(L"software_reporter_tool.exe"); |
63 } | 65 } |
64 | 66 |
65 void ExpectEmptyAttributes(const SwReporterInstallerTraits& traits) const { | 67 void ExpectEmptyAttributes(const SwReporterInstallerTraits& traits) const { |
66 update_client::InstallerAttributes attributes = | 68 update_client::InstallerAttributes attributes = |
67 traits.GetInstallerAttributes(); | 69 traits.GetInstallerAttributes(); |
68 EXPECT_TRUE(attributes.empty()); | 70 EXPECT_TRUE(attributes.empty()); |
69 } | 71 } |
70 | 72 |
71 // Expects that the SwReporter was launched exactly once, with no arguments. | 73 // Expects that the SwReporter was launched exactly once, with no arguments. |
72 void ExpectDefaultInvocation() const { | 74 void ExpectDefaultInvocation() const { |
73 EXPECT_EQ(default_version_, launched_version_); | 75 EXPECT_EQ(default_version_, launched_version_); |
74 ASSERT_EQ(1U, launched_invocations_.size()); | 76 ASSERT_EQ(1U, launched_invocations_.size()); |
75 | 77 |
76 const safe_browsing::SwReporterInvocation& invocation = | 78 const SwReporterInvocation& invocation = launched_invocations_.front(); |
77 launched_invocations_[0]; | |
78 EXPECT_EQ(MakeTestFilePath(default_path_), | 79 EXPECT_EQ(MakeTestFilePath(default_path_), |
79 invocation.command_line.GetProgram()); | 80 invocation.command_line.GetProgram()); |
80 EXPECT_TRUE(invocation.command_line.GetSwitches().empty()); | 81 EXPECT_TRUE(invocation.command_line.GetSwitches().empty()); |
81 EXPECT_TRUE(invocation.command_line.GetArgs().empty()); | 82 EXPECT_TRUE(invocation.command_line.GetArgs().empty()); |
82 EXPECT_TRUE(invocation.suffix.empty()); | 83 EXPECT_TRUE(invocation.suffix.empty()); |
83 EXPECT_FALSE(invocation.is_experimental); | 84 EXPECT_EQ(SwReporterInvocation::FLAG_LOG_TO_RAPPOR | |
| 85 SwReporterInvocation::FLAG_LOG_TO_PREFS | |
| 86 SwReporterInvocation::FLAG_TRIGGER_PROMPT, |
| 87 invocation.flags); |
84 } | 88 } |
85 | 89 |
86 // |ComponentReady| asserts that it is run on the UI thread, so we must | 90 // |ComponentReady| asserts that it is run on the UI thread, so we must |
87 // create test threads before calling it. | 91 // create test threads before calling it. |
88 content::TestBrowserThreadBundle threads_; | 92 content::TestBrowserThreadBundle threads_; |
89 | 93 |
90 // Bound callback to the |SwReporterLaunched| method. | 94 // Bound callback to the |SwReporterLaunched| method. |
91 SwReporterRunner launched_callback_; | 95 SwReporterRunner launched_callback_; |
92 | 96 |
93 // Default parameters for |ComponentReady|. | 97 // Default parameters for |ComponentReady|. |
94 base::Version default_version_; | 98 base::Version default_version_; |
95 base::FilePath default_path_; | 99 base::FilePath default_path_; |
96 | 100 |
97 // Results of running |ComponentReady|. | 101 // Results of running |ComponentReady|. |
98 std::vector<safe_browsing::SwReporterInvocation> launched_invocations_; | 102 safe_browsing::SwReporterQueue launched_invocations_; |
99 base::Version launched_version_; | 103 base::Version launched_version_; |
100 | 104 |
101 private: | 105 private: |
102 DISALLOW_COPY_AND_ASSIGN(SwReporterInstallerTest); | 106 DISALLOW_COPY_AND_ASSIGN(SwReporterInstallerTest); |
103 }; | 107 }; |
104 | 108 |
105 // This class contains extended setup that is only used for tests of the | 109 // This class contains extended setup that is only used for tests of the |
106 // experimental reporter. | 110 // experimental reporter. |
107 class ExperimentalSwReporterInstallerTest : public SwReporterInstallerTest { | 111 class ExperimentalSwReporterInstallerTest : public SwReporterInstallerTest { |
108 public: | 112 public: |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 // |expected_suffix| and one |expected_additional_argument| on the | 158 // |expected_suffix| and one |expected_additional_argument| on the |
155 // command-line. (|expected_additional_argument| mainly exists to test that | 159 // command-line. (|expected_additional_argument| mainly exists to test that |
156 // arguments are included at all, so there is no need to test for | 160 // arguments are included at all, so there is no need to test for |
157 // combinations of multiple arguments and switches in this function.) | 161 // combinations of multiple arguments and switches in this function.) |
158 void ExpectExperimentalInvocation( | 162 void ExpectExperimentalInvocation( |
159 const std::string& expected_suffix, | 163 const std::string& expected_suffix, |
160 const base::string16& expected_additional_argument) { | 164 const base::string16& expected_additional_argument) { |
161 EXPECT_EQ(default_version_, launched_version_); | 165 EXPECT_EQ(default_version_, launched_version_); |
162 ASSERT_EQ(1U, launched_invocations_.size()); | 166 ASSERT_EQ(1U, launched_invocations_.size()); |
163 | 167 |
164 const safe_browsing::SwReporterInvocation& invocation = | 168 const SwReporterInvocation& invocation = launched_invocations_.front(); |
165 launched_invocations_[0]; | |
166 EXPECT_EQ(MakeTestFilePath(default_path_), | 169 EXPECT_EQ(MakeTestFilePath(default_path_), |
167 invocation.command_line.GetProgram()); | 170 invocation.command_line.GetProgram()); |
168 | 171 |
169 if (expected_suffix.empty()) { | 172 if (expected_suffix.empty()) { |
170 EXPECT_TRUE(invocation.command_line.GetSwitches().empty()); | 173 EXPECT_TRUE(invocation.command_line.GetSwitches().empty()); |
171 EXPECT_TRUE(invocation.suffix.empty()); | 174 EXPECT_TRUE(invocation.suffix.empty()); |
172 } else { | 175 } else { |
173 EXPECT_EQ(1U, invocation.command_line.GetSwitches().size()); | 176 EXPECT_EQ(1U, invocation.command_line.GetSwitches().size()); |
174 EXPECT_EQ(expected_suffix, invocation.command_line.GetSwitchValueASCII( | 177 EXPECT_EQ(expected_suffix, invocation.command_line.GetSwitchValueASCII( |
175 kRegistrySuffixSwitch)); | 178 kRegistrySuffixSwitch)); |
176 EXPECT_EQ(expected_suffix, invocation.suffix); | 179 EXPECT_EQ(expected_suffix, invocation.suffix); |
177 } | 180 } |
178 | 181 |
179 if (expected_additional_argument.empty()) { | 182 if (expected_additional_argument.empty()) { |
180 EXPECT_TRUE(invocation.command_line.GetArgs().empty()); | 183 EXPECT_TRUE(invocation.command_line.GetArgs().empty()); |
181 } else { | 184 } else { |
182 EXPECT_EQ(1U, invocation.command_line.GetArgs().size()); | 185 EXPECT_EQ(1U, invocation.command_line.GetArgs().size()); |
183 EXPECT_EQ(expected_additional_argument, | 186 EXPECT_EQ(expected_additional_argument, |
184 invocation.command_line.GetArgs()[0]); | 187 invocation.command_line.GetArgs()[0]); |
185 } | 188 } |
186 | 189 |
187 EXPECT_TRUE(invocation.is_experimental); | 190 EXPECT_EQ(0, invocation.flags); |
188 histograms_.ExpectTotalCount(kErrorHistogramName, 0); | 191 histograms_.ExpectTotalCount(kErrorHistogramName, 0); |
189 } | 192 } |
190 | 193 |
191 void ExpectLaunchError() { | 194 void ExpectLaunchError() { |
192 // The SwReporter should not be launched, and an error should be logged. | 195 // The SwReporter should not be launched, and an error should be logged. |
193 EXPECT_TRUE(launched_invocations_.empty()); | 196 EXPECT_TRUE(launched_invocations_.empty()); |
194 histograms_.ExpectUniqueSample(kErrorHistogramName, | 197 histograms_.ExpectUniqueSample(kErrorHistogramName, |
195 SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS, 1); | 198 SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS, 1); |
196 } | 199 } |
197 | 200 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 270 |
268 TEST_F(ExperimentalSwReporterInstallerTest, SingleInvocation) { | 271 TEST_F(ExperimentalSwReporterInstallerTest, SingleInvocation) { |
269 SwReporterInstallerTraits traits(launched_callback_, true); | 272 SwReporterInstallerTraits traits(launched_callback_, true); |
270 CreateFeatureWithTag(kExperimentTag); | 273 CreateFeatureWithTag(kExperimentTag); |
271 ExpectAttributesWithTag(traits, kExperimentTag); | 274 ExpectAttributesWithTag(traits, kExperimentTag); |
272 | 275 |
273 static constexpr char kTestManifest[] = | 276 static constexpr char kTestManifest[] = |
274 "{\"launch_params\": [" | 277 "{\"launch_params\": [" |
275 " {" | 278 " {" |
276 " \"arguments\": [\"--engine=experimental\", \"random argument\"]," | 279 " \"arguments\": [\"--engine=experimental\", \"random argument\"]," |
277 " \"suffix\": \"TestSuffix\"" | 280 " \"suffix\": \"TestSuffix\"," |
| 281 " \"prompt\": false" |
278 " }" | 282 " }" |
279 "]}"; | 283 "]}"; |
280 traits.ComponentReady( | 284 traits.ComponentReady( |
281 default_version_, default_path_, | 285 default_version_, default_path_, |
282 base::DictionaryValue::From(base::JSONReader::Read(kTestManifest))); | 286 base::DictionaryValue::From(base::JSONReader::Read(kTestManifest))); |
283 | 287 |
284 // The SwReporter should be launched once with the given arguments. | 288 // The SwReporter should be launched once with the given arguments. |
285 EXPECT_EQ(default_version_, launched_version_); | 289 EXPECT_EQ(default_version_, launched_version_); |
286 ASSERT_EQ(1U, launched_invocations_.size()); | 290 ASSERT_EQ(1U, launched_invocations_.size()); |
287 | 291 |
288 const safe_browsing::SwReporterInvocation& invocation = | 292 const SwReporterInvocation& invocation = launched_invocations_.front(); |
289 launched_invocations_[0]; | |
290 EXPECT_EQ(MakeTestFilePath(default_path_), | 293 EXPECT_EQ(MakeTestFilePath(default_path_), |
291 invocation.command_line.GetProgram()); | 294 invocation.command_line.GetProgram()); |
292 EXPECT_EQ(2U, invocation.command_line.GetSwitches().size()); | 295 EXPECT_EQ(2U, invocation.command_line.GetSwitches().size()); |
293 EXPECT_EQ("experimental", | 296 EXPECT_EQ("experimental", |
294 invocation.command_line.GetSwitchValueASCII("engine")); | 297 invocation.command_line.GetSwitchValueASCII("engine")); |
295 EXPECT_EQ("TestSuffix", | 298 EXPECT_EQ("TestSuffix", |
296 invocation.command_line.GetSwitchValueASCII(kRegistrySuffixSwitch)); | 299 invocation.command_line.GetSwitchValueASCII(kRegistrySuffixSwitch)); |
297 ASSERT_EQ(1U, invocation.command_line.GetArgs().size()); | 300 ASSERT_EQ(1U, invocation.command_line.GetArgs().size()); |
298 EXPECT_EQ(L"random argument", invocation.command_line.GetArgs()[0]); | 301 EXPECT_EQ(L"random argument", invocation.command_line.GetArgs()[0]); |
299 EXPECT_EQ("TestSuffix", invocation.suffix); | 302 EXPECT_EQ("TestSuffix", invocation.suffix); |
300 EXPECT_TRUE(invocation.is_experimental); | 303 EXPECT_EQ(0, invocation.flags); |
301 histograms_.ExpectTotalCount(kErrorHistogramName, 0); | 304 histograms_.ExpectTotalCount(kErrorHistogramName, 0); |
302 } | 305 } |
303 | 306 |
304 TEST_F(ExperimentalSwReporterInstallerTest, MultipleInvocations) { | 307 TEST_F(ExperimentalSwReporterInstallerTest, MultipleInvocations) { |
305 SwReporterInstallerTraits traits(launched_callback_, true); | 308 SwReporterInstallerTraits traits(launched_callback_, true); |
306 CreateFeatureWithTag(kExperimentTag); | 309 CreateFeatureWithTag(kExperimentTag); |
307 ExpectAttributesWithTag(traits, kExperimentTag); | 310 ExpectAttributesWithTag(traits, kExperimentTag); |
308 | 311 |
309 static constexpr char kTestManifest[] = | 312 static constexpr char kTestManifest[] = |
310 "{\"launch_params\": [" | 313 "{\"launch_params\": [" |
311 " {" | 314 " {" |
312 " \"arguments\": [\"--engine=experimental\", \"random argument\"]," | 315 " \"arguments\": [\"--engine=experimental\", \"random argument\"]," |
313 " \"suffix\": \"TestSuffix\"" | 316 " \"suffix\": \"TestSuffix\"," |
| 317 " \"prompt\": false" |
314 " }," | 318 " }," |
315 " {" | 319 " {" |
316 " \"arguments\": [\"--engine=second\"]," | 320 " \"arguments\": [\"--engine=second\"]," |
317 " \"suffix\": \"SecondSuffix\"" | 321 " \"suffix\": \"SecondSuffix\"," |
| 322 " \"prompt\": true" |
| 323 " }," |
| 324 " {" |
| 325 " \"arguments\": [\"--engine=third\"]," |
| 326 " \"suffix\": \"ThirdSuffix\"" |
318 " }" | 327 " }" |
319 "]}"; | 328 "]}"; |
320 traits.ComponentReady( | 329 traits.ComponentReady( |
321 default_version_, default_path_, | 330 default_version_, default_path_, |
322 base::DictionaryValue::From(base::JSONReader::Read(kTestManifest))); | 331 base::DictionaryValue::From(base::JSONReader::Read(kTestManifest))); |
323 | 332 |
324 // Not supported yet. | 333 // The SwReporter should be launched three times with the given arguments. |
325 ExpectLaunchError(); | 334 EXPECT_EQ(default_version_, launched_version_); |
| 335 ASSERT_EQ(3U, launched_invocations_.size()); |
| 336 |
| 337 { |
| 338 SwReporterInvocation invocation = launched_invocations_.front(); |
| 339 launched_invocations_.pop(); |
| 340 EXPECT_EQ(MakeTestFilePath(default_path_), |
| 341 invocation.command_line.GetProgram()); |
| 342 EXPECT_EQ(2U, invocation.command_line.GetSwitches().size()); |
| 343 EXPECT_EQ("experimental", |
| 344 invocation.command_line.GetSwitchValueASCII("engine")); |
| 345 EXPECT_EQ("TestSuffix", invocation.command_line.GetSwitchValueASCII( |
| 346 kRegistrySuffixSwitch)); |
| 347 ASSERT_EQ(1U, invocation.command_line.GetArgs().size()); |
| 348 EXPECT_EQ(L"random argument", invocation.command_line.GetArgs()[0]); |
| 349 EXPECT_EQ("TestSuffix", invocation.suffix); |
| 350 EXPECT_EQ(0, invocation.flags); |
| 351 } |
| 352 |
| 353 { |
| 354 SwReporterInvocation invocation = launched_invocations_.front(); |
| 355 launched_invocations_.pop(); |
| 356 EXPECT_EQ(MakeTestFilePath(default_path_), |
| 357 invocation.command_line.GetProgram()); |
| 358 EXPECT_EQ(2U, invocation.command_line.GetSwitches().size()); |
| 359 EXPECT_EQ("second", invocation.command_line.GetSwitchValueASCII("engine")); |
| 360 EXPECT_EQ("SecondSuffix", invocation.command_line.GetSwitchValueASCII( |
| 361 kRegistrySuffixSwitch)); |
| 362 ASSERT_TRUE(invocation.command_line.GetArgs().empty()); |
| 363 EXPECT_EQ("SecondSuffix", invocation.suffix); |
| 364 EXPECT_EQ(SwReporterInvocation::FLAG_TRIGGER_PROMPT, invocation.flags); |
| 365 } |
| 366 |
| 367 { |
| 368 SwReporterInvocation invocation = launched_invocations_.front(); |
| 369 launched_invocations_.pop(); |
| 370 EXPECT_EQ(MakeTestFilePath(default_path_), |
| 371 invocation.command_line.GetProgram()); |
| 372 EXPECT_EQ(2U, invocation.command_line.GetSwitches().size()); |
| 373 EXPECT_EQ("third", invocation.command_line.GetSwitchValueASCII("engine")); |
| 374 EXPECT_EQ("ThirdSuffix", invocation.command_line.GetSwitchValueASCII( |
| 375 kRegistrySuffixSwitch)); |
| 376 ASSERT_TRUE(invocation.command_line.GetArgs().empty()); |
| 377 EXPECT_EQ("ThirdSuffix", invocation.suffix); |
| 378 // A missing "prompt" key means "false". |
| 379 EXPECT_EQ(0, invocation.flags); |
| 380 } |
| 381 |
| 382 histograms_.ExpectTotalCount(kErrorHistogramName, 0); |
326 } | 383 } |
327 | 384 |
328 TEST_F(ExperimentalSwReporterInstallerTest, MissingSuffix) { | 385 TEST_F(ExperimentalSwReporterInstallerTest, MissingSuffix) { |
329 SwReporterInstallerTraits traits(launched_callback_, true); | 386 SwReporterInstallerTraits traits(launched_callback_, true); |
330 CreateFeatureWithTag(kExperimentTag); | 387 CreateFeatureWithTag(kExperimentTag); |
331 | 388 |
332 static constexpr char kTestManifest[] = | 389 static constexpr char kTestManifest[] = |
333 "{\"launch_params\": [" | 390 "{\"launch_params\": [" |
334 " {" | 391 " {" |
335 " \"arguments\": [\"random argument\"]" | 392 " \"arguments\": [\"random argument\"]" |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
616 traits.ComponentReady( | 673 traits.ComponentReady( |
617 default_version_, default_path_, | 674 default_version_, default_path_, |
618 base::DictionaryValue::From(base::JSONReader::Read(kTestManifest))); | 675 base::DictionaryValue::From(base::JSONReader::Read(kTestManifest))); |
619 | 676 |
620 // The SwReporter should not be launched, and an error should be logged. | 677 // The SwReporter should not be launched, and an error should be logged. |
621 EXPECT_TRUE(launched_invocations_.empty()); | 678 EXPECT_TRUE(launched_invocations_.empty()); |
622 histograms_.ExpectUniqueSample(kErrorHistogramName, | 679 histograms_.ExpectUniqueSample(kErrorHistogramName, |
623 SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS, 1); | 680 SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS, 1); |
624 } | 681 } |
625 | 682 |
| 683 TEST_F(ExperimentalSwReporterInstallerTest, BadTypesInManifest4) { |
| 684 SwReporterInstallerTraits traits(launched_callback_, true); |
| 685 CreateFeatureWithTag(kExperimentTag); |
| 686 |
| 687 // This has an int instead of a bool for prompt. |
| 688 static constexpr char kTestManifest[] = |
| 689 "{\"launch_params\": [" |
| 690 " {" |
| 691 " \"arguments\": [\"--engine=experimental\"]," |
| 692 " \"suffix\": \"TestSuffix\"," |
| 693 " \"prompt\": 1" |
| 694 " }" |
| 695 "]}"; |
| 696 traits.ComponentReady( |
| 697 default_version_, default_path_, |
| 698 base::DictionaryValue::From(base::JSONReader::Read(kTestManifest))); |
| 699 |
| 700 // The SwReporter should not be launched, and an error should be logged. |
| 701 EXPECT_TRUE(launched_invocations_.empty()); |
| 702 histograms_.ExpectUniqueSample(kErrorHistogramName, |
| 703 SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS, 1); |
| 704 } |
626 } // namespace component_updater | 705 } // namespace component_updater |
OLD | NEW |