OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <tuple> | 5 #include <tuple> |
6 #include <windows.h> | 6 #include <windows.h> |
7 #include <versionhelpers.h> // windows.h must be before. | 7 #include <versionhelpers.h> // windows.h must be before. |
8 | 8 |
9 #include "base/test/test_reg_util_win.h" | 9 #include "base/test/test_reg_util_win.h" |
10 #include "base/win/registry.h" | 10 #include "base/win/registry.h" |
| 11 #include "chrome/install_static/install_util.h" |
11 #include "chrome_elf/chrome_elf_constants.h" | 12 #include "chrome_elf/chrome_elf_constants.h" |
12 #include "chrome_elf/chrome_elf_security.h" | 13 #include "chrome_elf/chrome_elf_security.h" |
13 #include "chrome_elf/nt_registry/nt_registry.h" | 14 #include "chrome_elf/nt_registry/nt_registry.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 16 #include "testing/platform_test.h" |
| 17 |
| 18 using namespace install_static; |
15 | 19 |
16 namespace { | 20 namespace { |
17 | 21 |
| 22 const wchar_t kCanaryExePath[] = |
| 23 L"C:\\Users\\user\\AppData\\Local\\Google\\Chrome SxS\\Application" |
| 24 L"\\chrome.exe"; |
| 25 const wchar_t kChromeSystemExePath[] = |
| 26 L"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe"; |
| 27 const wchar_t kChromeUserExePath[] = |
| 28 L"C:\\Users\\user\\AppData\\Local\\Google\\Chrome\\Application\\chrome.exe"; |
| 29 const wchar_t kChromiumExePath[] = |
| 30 L"C:\\Users\\user\\AppData\\Local\\Chromium\\Application\\chrome.exe"; |
| 31 |
18 bool SetSecurityFinchFlag(bool creation) { | 32 bool SetSecurityFinchFlag(bool creation) { |
19 bool success = true; | 33 bool success = true; |
20 base::win::RegKey security_key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); | 34 base::win::RegKey security_key(HKEY_CURRENT_USER, L"", KEY_ALL_ACCESS); |
21 | 35 |
22 if (creation) { | 36 if (creation) { |
23 if (ERROR_SUCCESS != | 37 if (ERROR_SUCCESS != |
24 security_key.CreateKey(elf_sec::kRegSecurityFinchPath, KEY_QUERY_VALUE)) | 38 security_key.CreateKey(elf_sec::kRegSecurityFinchPath, KEY_QUERY_VALUE)) |
25 success = false; | 39 success = false; |
26 } else { | 40 } else { |
27 if (ERROR_SUCCESS != security_key.DeleteKey(elf_sec::kRegSecurityFinchPath)) | 41 if (ERROR_SUCCESS != security_key.DeleteKey(elf_sec::kRegSecurityFinchPath)) |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 } | 86 } |
73 | 87 |
74 void CancelRegRedirect(nt::ROOT_KEY key) { | 88 void CancelRegRedirect(nt::ROOT_KEY key) { |
75 ASSERT_NE(key, nt::AUTO); | 89 ASSERT_NE(key, nt::AUTO); |
76 if (key == nt::HKCU) | 90 if (key == nt::HKCU) |
77 ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, base::string16())); | 91 ASSERT_TRUE(nt::SetTestingOverride(nt::HKCU, base::string16())); |
78 else | 92 else |
79 ASSERT_TRUE(nt::SetTestingOverride(nt::HKLM, base::string16())); | 93 ASSERT_TRUE(nt::SetTestingOverride(nt::HKLM, base::string16())); |
80 } | 94 } |
81 | 95 |
| 96 TEST(ChromeElfUtilTest, CanaryTest) { |
| 97 EXPECT_TRUE(IsSxSChrome(kCanaryExePath)); |
| 98 EXPECT_FALSE(IsSxSChrome(kChromeUserExePath)); |
| 99 EXPECT_FALSE(IsSxSChrome(kChromiumExePath)); |
| 100 } |
| 101 |
| 102 TEST(ChromeElfUtilTest, SystemInstallTest) { |
| 103 EXPECT_TRUE(IsSystemInstall(kChromeSystemExePath)); |
| 104 EXPECT_FALSE(IsSystemInstall(kChromeUserExePath)); |
| 105 } |
| 106 |
| 107 TEST(ChromeElfUtilTest, BrowserProcessTest) { |
| 108 EXPECT_EQ(ProcessType::UNINITIALIZED, g_process_type); |
| 109 InitializeProcessType(); |
| 110 EXPECT_FALSE(IsNonBrowserProcess()); |
| 111 } |
| 112 |
82 TEST(ChromeElfUtilTest, BrowserProcessSecurityTest) { | 113 TEST(ChromeElfUtilTest, BrowserProcessSecurityTest) { |
83 if (!::IsWindows8OrGreater()) | 114 if (!::IsWindows8OrGreater()) |
84 return; | 115 return; |
85 | 116 |
86 // Set up registry override for this test. | 117 // Set up registry override for this test. |
87 registry_util::RegistryOverrideManager override_manager; | 118 registry_util::RegistryOverrideManager override_manager; |
88 RegRedirect(nt::HKCU, &override_manager); | 119 RegRedirect(nt::HKCU, &override_manager); |
89 | 120 |
90 // First, ensure that the emergency-off finch signal works. | 121 // First, ensure that the emergency-off finch signal works. |
91 EXPECT_TRUE(SetSecurityFinchFlag(true)); | 122 EXPECT_TRUE(SetSecurityFinchFlag(true)); |
92 elf_security::EarlyBrowserSecurity(); | 123 elf_security::EarlyBrowserSecurity(); |
93 EXPECT_FALSE(IsSecuritySet()); | 124 EXPECT_FALSE(IsSecuritySet()); |
94 EXPECT_TRUE(SetSecurityFinchFlag(false)); | 125 EXPECT_TRUE(SetSecurityFinchFlag(false)); |
95 | 126 |
96 // Second, test that the process mitigation is set when no finch signal. | 127 // Second, test that the process mitigation is set when no finch signal. |
97 elf_security::EarlyBrowserSecurity(); | 128 elf_security::EarlyBrowserSecurity(); |
98 EXPECT_TRUE(IsSecuritySet()); | 129 EXPECT_TRUE(IsSecuritySet()); |
99 | 130 |
100 CancelRegRedirect(nt::HKCU); | 131 CancelRegRedirect(nt::HKCU); |
101 } | 132 } |
102 | 133 |
| 134 // Parameterized test with paramters: |
| 135 // 1: product: "canary" or "google" |
| 136 // 2: install level: "user" or "system" |
| 137 // 3: install mode: "single" or "multi" |
| 138 class ChromeElfUtilTest |
| 139 : public testing::TestWithParam< |
| 140 std::tuple<const char*, const char*, const char*>> { |
| 141 protected: |
| 142 void SetUp() override { |
| 143 // Set up registry override for these tests. |
| 144 RegRedirect(nt::HKLM, &override_manager_); |
| 145 RegRedirect(nt::HKCU, &override_manager_); |
| 146 |
| 147 const char* app; |
| 148 const char* level; |
| 149 const char* mode; |
| 150 std::tie(app, level, mode) = GetParam(); |
| 151 is_canary_ = (std::string(app) == "canary"); |
| 152 system_level_ = (std::string(level) != "user"); |
| 153 multi_install_ = (std::string(mode) != "single"); |
| 154 if (is_canary_) { |
| 155 ASSERT_FALSE(system_level_); |
| 156 ASSERT_FALSE(multi_install_); |
| 157 app_guid_ = kAppGuidCanary; |
| 158 chrome_path_ = kCanaryExePath; |
| 159 } else { |
| 160 app_guid_ = kAppGuidGoogleChrome; |
| 161 chrome_path_ = |
| 162 (system_level_ ? kChromeSystemExePath : kChromeUserExePath); |
| 163 } |
| 164 if (multi_install_) { |
| 165 SetMultiInstallStateInRegistry(system_level_, true); |
| 166 app_guid_ = kAppGuidGoogleBinaries; |
| 167 } |
| 168 } |
| 169 |
| 170 void TearDown() override { |
| 171 CancelRegRedirect(nt::HKCU); |
| 172 CancelRegRedirect(nt::HKLM); |
| 173 } |
| 174 |
| 175 base::string16 BuildKey(const wchar_t* path, const wchar_t* guid) { |
| 176 base::string16 full_key_path(path); |
| 177 full_key_path.append(1, L'\\'); |
| 178 full_key_path.append(guid); |
| 179 return full_key_path; |
| 180 } |
| 181 |
| 182 void SetUsageStat(DWORD value, bool state_medium) { |
| 183 LONG result = base::win::RegKey( |
| 184 system_level_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, |
| 185 BuildKey(state_medium ? kRegPathClientStateMedium |
| 186 : kRegPathClientState, |
| 187 app_guid_) |
| 188 .c_str(), |
| 189 KEY_SET_VALUE) |
| 190 .WriteValue(kRegValueUsageStats, value); |
| 191 ASSERT_EQ(ERROR_SUCCESS, result); |
| 192 } |
| 193 |
| 194 void SetMultiInstallStateInRegistry(bool system_install, bool multi) { |
| 195 base::win::RegKey key( |
| 196 system_install ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, |
| 197 BuildKey(kRegPathClientState, kAppGuidGoogleChrome).c_str(), |
| 198 KEY_SET_VALUE); |
| 199 LONG result; |
| 200 if (multi) { |
| 201 result = key.WriteValue(kUninstallArgumentsField, |
| 202 L"yadda yadda --multi-install yadda yadda"); |
| 203 } else { |
| 204 result = key.DeleteValue(kUninstallArgumentsField); |
| 205 } |
| 206 ASSERT_EQ(ERROR_SUCCESS, result); |
| 207 } |
| 208 |
| 209 void SetChannelName(const base::string16& channel_name) { |
| 210 LONG result = |
| 211 base::win::RegKey( |
| 212 system_level_ ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, |
| 213 BuildKey(kRegPathClientState, app_guid_).c_str(), KEY_SET_VALUE) |
| 214 .WriteValue(kRegApField, channel_name.c_str()); |
| 215 ASSERT_EQ(ERROR_SUCCESS, result); |
| 216 } |
| 217 |
| 218 // This function tests the install_static::GetChromeChannelName function and |
| 219 // is based on the ChannelInfoTest.Channels in channel_info_unittest.cc. |
| 220 // The |add_modifier| parameter controls whether we expect modifiers in the |
| 221 // returned channel name. |
| 222 void PerformChannelNameTests(bool add_modifier) { |
| 223 // We can't test the channel name correctly for canary mode because the |
| 224 // install_static checks whether an exe is a canary executable is based on |
| 225 // the path where the exe is running from. |
| 226 if (is_canary_) |
| 227 return; |
| 228 SetChannelName(L""); |
| 229 base::string16 channel; |
| 230 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 231 &channel); |
| 232 if (multi_install_ && add_modifier) { |
| 233 EXPECT_STREQ(L"m", channel.c_str()); |
| 234 } else { |
| 235 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 236 } |
| 237 |
| 238 SetChannelName(L"-full"); |
| 239 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 240 &channel); |
| 241 if (multi_install_ && add_modifier) { |
| 242 EXPECT_STREQ(L"m", channel.c_str()); |
| 243 } else { |
| 244 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 245 } |
| 246 |
| 247 SetChannelName(L"1.1-beta"); |
| 248 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 249 &channel); |
| 250 if (multi_install_ && add_modifier) { |
| 251 EXPECT_STREQ(L"beta-m", channel.c_str()); |
| 252 } else { |
| 253 EXPECT_STREQ(install_static::kChromeChannelBeta, channel.c_str()); |
| 254 } |
| 255 |
| 256 SetChannelName(L"1.1-beta"); |
| 257 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 258 &channel); |
| 259 if (multi_install_ && add_modifier) { |
| 260 EXPECT_STREQ(L"beta-m", channel.c_str()); |
| 261 } else { |
| 262 EXPECT_STREQ(install_static::kChromeChannelBeta, channel.c_str()); |
| 263 } |
| 264 |
| 265 SetChannelName(L"1.1-bar"); |
| 266 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 267 &channel); |
| 268 if (multi_install_ && add_modifier) { |
| 269 EXPECT_STREQ(L"beta-m", channel.c_str()); |
| 270 } else { |
| 271 EXPECT_STREQ(install_static::kChromeChannelBeta, channel.c_str()); |
| 272 } |
| 273 |
| 274 SetChannelName(L"1n1-foobar"); |
| 275 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 276 &channel); |
| 277 if (multi_install_ && add_modifier) { |
| 278 EXPECT_STREQ(L"beta-m", channel.c_str()); |
| 279 } else { |
| 280 EXPECT_STREQ(install_static::kChromeChannelBeta, channel.c_str()); |
| 281 } |
| 282 |
| 283 SetChannelName(L"foo-1.1-beta"); |
| 284 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 285 &channel); |
| 286 if (multi_install_ && add_modifier) { |
| 287 EXPECT_STREQ(L"m", channel.c_str()); |
| 288 } else { |
| 289 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 290 } |
| 291 SetChannelName(L"2.0-beta"); |
| 292 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 293 &channel); |
| 294 if (multi_install_ && add_modifier) { |
| 295 EXPECT_STREQ(L"m", channel.c_str()); |
| 296 } else { |
| 297 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 298 } |
| 299 |
| 300 SetChannelName(L"2.0-dev"); |
| 301 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 302 &channel); |
| 303 if (multi_install_ && add_modifier) { |
| 304 EXPECT_STREQ(L"dev-m", channel.c_str()); |
| 305 } else { |
| 306 EXPECT_STREQ(install_static::kChromeChannelDev, channel.c_str()); |
| 307 } |
| 308 SetChannelName(L"2.0-DEV"); |
| 309 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 310 &channel); |
| 311 if (multi_install_ && add_modifier) { |
| 312 EXPECT_STREQ(L"dev-m", channel.c_str()); |
| 313 } else { |
| 314 EXPECT_STREQ(install_static::kChromeChannelDev, channel.c_str()); |
| 315 } |
| 316 SetChannelName(L"2.0-dev-eloper"); |
| 317 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 318 &channel); |
| 319 if (multi_install_ && add_modifier) { |
| 320 EXPECT_STREQ(L"dev-m", channel.c_str()); |
| 321 } else { |
| 322 EXPECT_STREQ(install_static::kChromeChannelDev, channel.c_str()); |
| 323 } |
| 324 SetChannelName(L"2.0-doom"); |
| 325 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 326 &channel); |
| 327 if (multi_install_ && add_modifier) { |
| 328 EXPECT_STREQ(L"dev-m", channel.c_str()); |
| 329 } else { |
| 330 EXPECT_STREQ(install_static::kChromeChannelDev, channel.c_str()); |
| 331 } |
| 332 SetChannelName(L"250-doom"); |
| 333 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 334 &channel); |
| 335 if (multi_install_ && add_modifier) { |
| 336 EXPECT_STREQ(L"dev-m", channel.c_str()); |
| 337 } else { |
| 338 EXPECT_STREQ(install_static::kChromeChannelDev, channel.c_str()); |
| 339 } |
| 340 SetChannelName(L"bar-2.0-dev"); |
| 341 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 342 &channel); |
| 343 if (multi_install_ && add_modifier) { |
| 344 EXPECT_STREQ(L"m", channel.c_str()); |
| 345 } else { |
| 346 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 347 } |
| 348 SetChannelName(L"1.0-dev"); |
| 349 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 350 &channel); |
| 351 if (multi_install_ && add_modifier) { |
| 352 EXPECT_STREQ(L"m", channel.c_str()); |
| 353 } else { |
| 354 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 355 } |
| 356 |
| 357 SetChannelName(L"x64-beta"); |
| 358 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 359 &channel); |
| 360 if (multi_install_ && add_modifier) { |
| 361 EXPECT_STREQ(L"beta-m", channel.c_str()); |
| 362 } else { |
| 363 EXPECT_STREQ(install_static::kChromeChannelBeta, channel.c_str()); |
| 364 } |
| 365 SetChannelName(L"bar-x64-beta"); |
| 366 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 367 &channel); |
| 368 if (multi_install_ && add_modifier) { |
| 369 EXPECT_STREQ(L"beta-m", channel.c_str()); |
| 370 } else { |
| 371 EXPECT_STREQ(install_static::kChromeChannelBeta, channel.c_str()); |
| 372 } |
| 373 SetChannelName(L"x64-Beta"); |
| 374 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 375 &channel); |
| 376 if (multi_install_ && add_modifier) { |
| 377 EXPECT_STREQ(L"beta-m", channel.c_str()); |
| 378 } else { |
| 379 EXPECT_STREQ(install_static::kChromeChannelBeta, channel.c_str()); |
| 380 } |
| 381 |
| 382 SetChannelName(L"x64-stable"); |
| 383 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 384 &channel); |
| 385 if (multi_install_ && add_modifier) { |
| 386 EXPECT_STREQ(L"m", channel.c_str()); |
| 387 } else { |
| 388 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 389 } |
| 390 SetChannelName(L"baz-x64-stable"); |
| 391 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 392 &channel); |
| 393 if (multi_install_ && add_modifier) { |
| 394 EXPECT_STREQ(L"m", channel.c_str()); |
| 395 } else { |
| 396 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 397 } |
| 398 SetChannelName(L"x64-Stable"); |
| 399 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 400 &channel); |
| 401 if (multi_install_ && add_modifier) { |
| 402 EXPECT_STREQ(L"m", channel.c_str()); |
| 403 } else { |
| 404 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 405 } |
| 406 |
| 407 SetChannelName(L"fuzzy"); |
| 408 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 409 &channel); |
| 410 if (multi_install_ && add_modifier) { |
| 411 EXPECT_STREQ(L"m", channel.c_str()); |
| 412 } else { |
| 413 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 414 } |
| 415 SetChannelName(L"foo"); |
| 416 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 417 &channel); |
| 418 if (multi_install_ && add_modifier) { |
| 419 EXPECT_STREQ(L"m", channel.c_str()); |
| 420 } else { |
| 421 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()); |
| 422 } |
| 423 // Variations on stable channel. |
| 424 static constexpr const wchar_t* kStableApValues[] = { |
| 425 L"-multi-chrome", |
| 426 L"x64-stable-multi-chrome", |
| 427 L"-stage:ensemble_patching-multi-chrome-full", |
| 428 L"-multi-chrome-full", |
| 429 }; |
| 430 for (const wchar_t* ap_value : kStableApValues) { |
| 431 SetChannelName(ap_value); |
| 432 install_static::GetChromeChannelName(!system_level_, add_modifier, |
| 433 &channel); |
| 434 if (multi_install_ && add_modifier) { |
| 435 EXPECT_STREQ(L"m", channel.c_str()) << ap_value; |
| 436 } else { |
| 437 EXPECT_STREQ(install_static::kChromeChannelStable, channel.c_str()) |
| 438 << ap_value; |
| 439 } |
| 440 } |
| 441 } |
| 442 |
| 443 const wchar_t* app_guid_; |
| 444 const wchar_t* chrome_path_; |
| 445 bool system_level_; |
| 446 bool multi_install_; |
| 447 bool is_canary_; |
| 448 registry_util::RegistryOverrideManager override_manager_; |
| 449 }; |
| 450 |
| 451 TEST_P(ChromeElfUtilTest, MultiInstallTest) { |
| 452 if (is_canary_) |
| 453 return; |
| 454 SetMultiInstallStateInRegistry(system_level_, true); |
| 455 EXPECT_TRUE(IsMultiInstall(system_level_)); |
| 456 |
| 457 SetMultiInstallStateInRegistry(system_level_, false); |
| 458 EXPECT_FALSE(IsMultiInstall(system_level_)); |
| 459 } |
| 460 |
| 461 TEST_P(ChromeElfUtilTest, UsageStatsAbsent) { |
| 462 EXPECT_FALSE(GetCollectStatsConsentForTesting(chrome_path_)); |
| 463 } |
| 464 |
| 465 TEST_P(ChromeElfUtilTest, UsageStatsZero) { |
| 466 SetUsageStat(0, false); |
| 467 EXPECT_FALSE(GetCollectStatsConsentForTesting(chrome_path_)); |
| 468 } |
| 469 |
| 470 TEST_P(ChromeElfUtilTest, UsageStatsOne) { |
| 471 SetUsageStat(1, false); |
| 472 EXPECT_TRUE(GetCollectStatsConsentForTesting(chrome_path_)); |
| 473 if (is_canary_) { |
| 474 EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeUserExePath)); |
| 475 EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeSystemExePath)); |
| 476 } else if (system_level_) { |
| 477 EXPECT_FALSE(GetCollectStatsConsentForTesting(kCanaryExePath)); |
| 478 EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeUserExePath)); |
| 479 } else { |
| 480 EXPECT_FALSE(GetCollectStatsConsentForTesting(kCanaryExePath)); |
| 481 EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeSystemExePath)); |
| 482 } |
| 483 } |
| 484 |
| 485 TEST_P(ChromeElfUtilTest, UsageStatsZeroInStateMedium) { |
| 486 if (!system_level_) |
| 487 return; |
| 488 SetUsageStat(0, true); |
| 489 EXPECT_FALSE(GetCollectStatsConsentForTesting(chrome_path_)); |
| 490 } |
| 491 |
| 492 TEST_P(ChromeElfUtilTest, UsageStatsOneInStateMedium) { |
| 493 if (!system_level_) |
| 494 return; |
| 495 SetUsageStat(1, true); |
| 496 EXPECT_TRUE(GetCollectStatsConsentForTesting(chrome_path_)); |
| 497 EXPECT_FALSE(GetCollectStatsConsentForTesting(kCanaryExePath)); |
| 498 EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeUserExePath)); |
| 499 } |
| 500 |
| 501 // TODO(ananta) |
| 502 // Move this to install_static_unittests. |
| 503 // http://crbug.com/604923 |
| 504 // This test tests the install_static::GetChromeChannelName function and is |
| 505 // based on the ChannelInfoTest.Channels in channel_info_unittest.cc |
| 506 TEST_P(ChromeElfUtilTest, InstallStaticGetChannelNameTest) { |
| 507 PerformChannelNameTests(true); // add_modifier |
| 508 PerformChannelNameTests(false); // !add_modifier |
| 509 } |
| 510 |
| 511 INSTANTIATE_TEST_CASE_P(Canary, |
| 512 ChromeElfUtilTest, |
| 513 testing::Combine(testing::Values("canary"), |
| 514 testing::Values("user"), |
| 515 testing::Values("single"))); |
| 516 INSTANTIATE_TEST_CASE_P(GoogleChrome, |
| 517 ChromeElfUtilTest, |
| 518 testing::Combine(testing::Values("google"), |
| 519 testing::Values("user", "system"), |
| 520 testing::Values("single", "multi"))); |
| 521 |
103 } // namespace | 522 } // namespace |
OLD | NEW |