Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2379)

Unified Diff: chrome_elf/chrome_elf_util_unittest.cc

Issue 1913943003: Remove dependencies on chrome\installer from the ChromeCrashReporterClient class on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Declare common constants in install_util.h and remove dups from chrome_elf_util_unittest.cc Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome_elf/chrome_elf_util_unittest.cc
diff --git a/chrome_elf/chrome_elf_util_unittest.cc b/chrome_elf/chrome_elf_util_unittest.cc
index 26b3a26cdd1a62764ae11404df7edf71f17ce02e..583d85eaf93d0022bc5df34ada472c6dcaad15cf 100644
--- a/chrome_elf/chrome_elf_util_unittest.cc
+++ b/chrome_elf/chrome_elf_util_unittest.cc
@@ -10,20 +10,9 @@
#include "testing/gtest/include/gtest/gtest.h"
#include "testing/platform_test.h"
-namespace {
-
-const wchar_t kRegPathClientState[] = L"Software\\Google\\Update\\ClientState";
-const wchar_t kRegPathClientStateMedium[] =
- L"Software\\Google\\Update\\ClientStateMedium";
-const wchar_t kRegValueUsageStats[] = L"usagestats";
-const wchar_t kUninstallArgumentsField[] = L"UninstallArguments";
+using namespace install_static;
-const wchar_t kAppGuidCanary[] =
- L"{4ea16ac7-fd5a-47c3-875b-dbf4a2008c20}";
-const wchar_t kAppGuidGoogleChrome[] =
- L"{8A69D345-D564-463c-AFF1-A69D9E530F96}";
-const wchar_t kAppGuidGoogleBinaries[] =
- L"{4DC8B4CA-1BDA-483e-B5FA-D3C12E15B62D}";
+namespace {
const wchar_t kCanaryExePath[] =
L"C:\\Users\\user\\AppData\\Local\\Google\\Chrome SxS\\Application"
@@ -35,11 +24,10 @@ const wchar_t kChromeUserExePath[] =
const wchar_t kChromiumExePath[] =
L"C:\\Users\\user\\AppData\\Local\\Chromium\\Application\\chrome.exe";
-
TEST(ChromeElfUtilTest, CanaryTest) {
- EXPECT_TRUE(IsCanary(kCanaryExePath));
- EXPECT_FALSE(IsCanary(kChromeUserExePath));
- EXPECT_FALSE(IsCanary(kChromiumExePath));
+ EXPECT_TRUE(IsSxSChrome(kCanaryExePath));
+ EXPECT_FALSE(IsSxSChrome(kChromeUserExePath));
+ EXPECT_FALSE(IsSxSChrome(kChromiumExePath));
}
TEST(ChromeElfUtilTest, SystemInstallTest) {
@@ -138,26 +126,26 @@ TEST_P(ChromeElfUtilTest, MultiInstallTest) {
}
TEST_P(ChromeElfUtilTest, UsageStatsAbsent) {
- EXPECT_FALSE(AreUsageStatsEnabled(chrome_path_));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(chrome_path_));
}
TEST_P(ChromeElfUtilTest, UsageStatsZero) {
SetUsageStat(0, false);
- EXPECT_FALSE(AreUsageStatsEnabled(chrome_path_));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(chrome_path_));
}
TEST_P(ChromeElfUtilTest, UsageStatsOne) {
SetUsageStat(1, false);
- EXPECT_TRUE(AreUsageStatsEnabled(chrome_path_));
+ EXPECT_TRUE(GetCollectStatsConsentForTesting(chrome_path_));
if (is_canary_) {
- EXPECT_FALSE(AreUsageStatsEnabled(kChromeUserExePath));
- EXPECT_FALSE(AreUsageStatsEnabled(kChromeSystemExePath));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeUserExePath));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeSystemExePath));
} else if (system_level_) {
- EXPECT_FALSE(AreUsageStatsEnabled(kCanaryExePath));
- EXPECT_FALSE(AreUsageStatsEnabled(kChromeUserExePath));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(kCanaryExePath));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeUserExePath));
} else {
- EXPECT_FALSE(AreUsageStatsEnabled(kCanaryExePath));
- EXPECT_FALSE(AreUsageStatsEnabled(kChromeSystemExePath));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(kCanaryExePath));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeSystemExePath));
}
}
@@ -165,16 +153,16 @@ TEST_P(ChromeElfUtilTest, UsageStatsZeroInStateMedium) {
if (!system_level_)
return;
SetUsageStat(0, true);
- EXPECT_FALSE(AreUsageStatsEnabled(chrome_path_));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(chrome_path_));
}
TEST_P(ChromeElfUtilTest, UsageStatsOneInStateMedium) {
if (!system_level_)
return;
SetUsageStat(1, true);
- EXPECT_TRUE(AreUsageStatsEnabled(chrome_path_));
- EXPECT_FALSE(AreUsageStatsEnabled(kCanaryExePath));
- EXPECT_FALSE(AreUsageStatsEnabled(kChromeUserExePath));
+ EXPECT_TRUE(GetCollectStatsConsentForTesting(chrome_path_));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(kCanaryExePath));
+ EXPECT_FALSE(GetCollectStatsConsentForTesting(kChromeUserExePath));
}
INSTANTIATE_TEST_CASE_P(Canary, ChromeElfUtilTest,
@@ -186,4 +174,23 @@ INSTANTIATE_TEST_CASE_P(GoogleChrome, ChromeElfUtilTest,
testing::Values("user", "system"),
testing::Values("single", "multi")));
+// Tests the MatchPattern function in the install_static library.
+// TODO(ananta)
+// Move this to install_static_unittests.
+// http://crbug.com/604923
+TEST(MiscUtilTest, InstallStaticMatchPattern) {
+ EXPECT_TRUE(install_static::MatchPattern(L"", L""));
+ EXPECT_TRUE(install_static::MatchPattern(L"", L"*"));
+ EXPECT_FALSE(install_static::MatchPattern(L"", L"*a"));
+ EXPECT_FALSE(install_static::MatchPattern(L"", L"abc"));
+ EXPECT_TRUE(install_static::MatchPattern(L"Hello1234", L"He??o*1*"));
+ EXPECT_TRUE(install_static::MatchPattern(L"Foo", L"F*?"));
+ EXPECT_TRUE(install_static::MatchPattern(L"Foo", L"F*"));
+ EXPECT_FALSE(install_static::MatchPattern(L"Foo", L"F*b"));
+ EXPECT_TRUE(install_static::MatchPattern(L"abcd", L"*c*d"));
+ EXPECT_TRUE(install_static::MatchPattern(L"abcd", L"*?c*d"));
+ EXPECT_FALSE(install_static::MatchPattern(L"abcd", L"abcd*efgh"));
+ EXPECT_TRUE(install_static::MatchPattern(L"foobarabc", L"*bar*"));
+}
+
} // namespace

Powered by Google App Engine
This is Rietveld 408576698