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

Unified Diff: chrome/installer/gcapi/gcapi_reactivation_test.cc

Issue 9465013: Mike's change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressing Roger's feedback. Created 8 years, 10 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
« no previous file with comments | « chrome/installer/gcapi/gcapi_reactivation.cc ('k') | chrome/installer/gcapi/gcapi_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/gcapi/gcapi_reactivation_test.cc
diff --git a/chrome/installer/gcapi/gcapi_reactivation_test.cc b/chrome/installer/gcapi/gcapi_reactivation_test.cc
index 822cb80ac71b71f89d383eb189b871411ea57ce1..66c2882cf67986a6903709bcec4136a736f812e8 100644
--- a/chrome/installer/gcapi/gcapi_reactivation_test.cc
+++ b/chrome/installer/gcapi/gcapi_reactivation_test.cc
@@ -78,14 +78,14 @@ class GCAPIReactivationTest : public ::testing::Test {
last_run_time_string.c_str()) == ERROR_SUCCESS);
}
- bool HasExperimentLabels() {
+ bool HasExperimentLabels(HKEY hive) {
int label_count = 0;
for (int i = 0; i < arraysize(kExperimentAppGuids); ++i) {
string16 client_state_path(google_update::kRegPathClientState);
client_state_path += L"\\";
client_state_path += kExperimentAppGuids[i];
- RegKey client_state_key(HKEY_LOCAL_MACHINE,
+ RegKey client_state_key(hive,
client_state_path.c_str(),
KEY_QUERY_VALUE);
if (client_state_key.Valid() &&
@@ -122,7 +122,7 @@ class GCAPIReactivationTest : public ::testing::Test {
};
TEST_F(GCAPIReactivationTest, CheckSetReactivationBrandCode) {
- EXPECT_TRUE(SetReactivationBrandCode(L"GAGA"));
+ EXPECT_TRUE(SetReactivationBrandCode(L"GAGA", GCAPI_INVOKED_STANDARD_SHELL));
EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER));
std::vector<std::wstring> check_codes;
@@ -142,20 +142,26 @@ TEST_F(GCAPIReactivationTest, CanOfferReactivation_Basic) {
// We're not installed yet. Make sure CanOfferReactivation fails.
EXPECT_FALSE(CanOfferReactivation(L"GAGA", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands,
+ GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(REACTIVATE_ERROR_NOTINSTALLED, error);
// Now pretend to be installed. CanOfferReactivation should pass.
EXPECT_TRUE(SetChromeInstallMarker(HKEY_CURRENT_USER));
EXPECT_TRUE(CanOfferReactivation(L"GAGA", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands,
+ GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
// Now set a recent last_run value. CanOfferReactivation should fail again.
Time hkcu_last_run = Time::NowFromSystemTime() - TimeDelta::FromDays(20);
EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER,
hkcu_last_run.ToInternalValue()));
EXPECT_FALSE(CanOfferReactivation(L"GAGA", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands,
+ GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(REACTIVATE_ERROR_NOTDORMANT, error);
// Now set a last_run value that exceeds the threshold.
@@ -164,23 +170,33 @@ TEST_F(GCAPIReactivationTest, CanOfferReactivation_Basic) {
EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER,
hkcu_last_run.ToInternalValue()));
EXPECT_TRUE(CanOfferReactivation(L"GAGA", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands,
+ GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
// Test some invalid inputs
EXPECT_FALSE(CanOfferReactivation(NULL, arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands,
+ GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(REACTIVATE_ERROR_INVALID_INPUT, error);
EXPECT_FALSE(CanOfferReactivation(L"GAGA", arraysize(previous_brands),
- NULL, &error));
+ NULL, GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(REACTIVATE_ERROR_INVALID_INPUT, error);
// One more valid one
- EXPECT_TRUE(CanOfferReactivation(L"GAGA", 0, NULL, &error));
+ EXPECT_TRUE(CanOfferReactivation(L"GAGA", 0, NULL,
+ GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
// Check that the previous brands check works:
- EXPECT_TRUE(SetReactivationBrandCode(L"GOOGOO"));
+ EXPECT_TRUE(SetReactivationBrandCode(L"GOOGOO",
+ GCAPI_INVOKED_STANDARD_SHELL));
EXPECT_FALSE(CanOfferReactivation(L"GAGA", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands,
+ GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(REACTIVATE_ERROR_ALREADY_REACTIVATED, error);
}
@@ -197,22 +213,26 @@ TEST_F(GCAPIReactivationTest, Reactivation_Flow) {
hkcu_last_run.ToInternalValue()));
EXPECT_TRUE(ReactivateChrome(L"GAGA", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands, GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER));
// Make sure we can't reactivate again:
EXPECT_FALSE(ReactivateChrome(L"GAGA", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands, GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(REACTIVATE_ERROR_ALREADY_REACTIVATED, error);
// Should still be able to reactivate under other brands:
EXPECT_TRUE(ReactivateChrome(L"MAMA", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands, GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(L"MAMA", GetReactivationString(HKEY_CURRENT_USER));
// Validate that previous_brands are rejected:
EXPECT_FALSE(ReactivateChrome(L"PFFT", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands, GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(REACTIVATE_ERROR_ALREADY_REACTIVATED, error);
EXPECT_EQ(L"MAMA", GetReactivationString(HKEY_CURRENT_USER));
}
@@ -230,8 +250,9 @@ TEST_F(GCAPIReactivationTest, ExperimentLabelCheck) {
hkcu_last_run.ToInternalValue()));
EXPECT_TRUE(ReactivateChrome(L"GAGA", arraysize(previous_brands),
- previous_brands, &error));
+ previous_brands, GCAPI_INVOKED_STANDARD_SHELL,
+ &error));
EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER));
- EXPECT_TRUE(HasExperimentLabels());
+ EXPECT_TRUE(HasExperimentLabels(HKEY_CURRENT_USER));
}
« no previous file with comments | « chrome/installer/gcapi/gcapi_reactivation.cc ('k') | chrome/installer/gcapi/gcapi_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698