OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/guid.h" | 8 #include "base/guid.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/test/test_reg_util_win.h" | 12 #include "base/test/test_reg_util_win.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "base/win/registry.h" | 14 #include "base/win/registry.h" |
15 #include "chrome/installer/gcapi/gcapi.h" | 15 #include "chrome/installer/gcapi/gcapi.h" |
16 #include "chrome/installer/gcapi/gcapi_omaha_experiment.h" | 16 #include "chrome/installer/gcapi/gcapi_omaha_experiment.h" |
17 #include "chrome/installer/gcapi/gcapi_reactivation.h" | 17 #include "chrome/installer/gcapi/gcapi_reactivation.h" |
18 #include "chrome/installer/util/google_update_constants.h" | 18 #include "chrome/installer/util/google_update_constants.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 | 20 |
21 using base::Time; | 21 using base::Time; |
22 using base::TimeDelta; | 22 using base::TimeDelta; |
23 using base::win::RegKey; | 23 using base::win::RegKey; |
24 | 24 |
25 class GCAPIReactivationTest : public ::testing::Test { | 25 class GCAPIReactivationTest : public ::testing::Test { |
26 protected: | 26 protected: |
27 void SetUp() { | 27 void SetUp() { |
grt (UTC plus 2)
2013/11/07 02:39:33
while you're here:
virtual void SetUp() OVERRIDE
tommycli
2013/11/07 18:02:07
Done.
| |
28 // Override keys - this is undone during destruction. | 28 // Override keys - this is undone during destruction. |
29 std::wstring hkcu_override = base::StringPrintf( | 29 override_manager_.OverrideRegistry(HKEY_CURRENT_USER, L"hkcu_override"); |
30 L"hkcu_override\\%ls", ASCIIToWide(base::GenerateGUID())); | 30 override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE, L"hklm_override"); |
31 override_manager_.OverrideRegistry(HKEY_CURRENT_USER, hkcu_override); | |
32 std::wstring hklm_override = base::StringPrintf( | |
33 L"hklm_override\\%ls", ASCIIToWide(base::GenerateGUID())); | |
34 override_manager_.OverrideRegistry(HKEY_LOCAL_MACHINE, hklm_override); | |
35 } | 31 } |
36 | 32 |
37 bool SetChromeInstallMarker(HKEY hive) { | 33 bool SetChromeInstallMarker(HKEY hive) { |
38 // Create the client state keys in the right places. | 34 // Create the client state keys in the right places. |
39 std::wstring reg_path(google_update::kRegPathClients); | 35 std::wstring reg_path(google_update::kRegPathClients); |
40 reg_path += L"\\"; | 36 reg_path += L"\\"; |
41 reg_path += google_update::kChromeUpgradeCode; | 37 reg_path += google_update::kChromeUpgradeCode; |
42 RegKey client_state(hive, | 38 RegKey client_state(hive, |
43 reg_path.c_str(), | 39 reg_path.c_str(), |
44 KEY_CREATE_SUB_KEY | KEY_SET_VALUE); | 40 KEY_CREATE_SUB_KEY | KEY_SET_VALUE); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
212 EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER, | 208 EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER, |
213 hkcu_last_run.ToInternalValue())); | 209 hkcu_last_run.ToInternalValue())); |
214 | 210 |
215 EXPECT_TRUE(ReactivateChrome(L"GAGA", | 211 EXPECT_TRUE(ReactivateChrome(L"GAGA", |
216 GCAPI_INVOKED_STANDARD_SHELL, | 212 GCAPI_INVOKED_STANDARD_SHELL, |
217 &error)); | 213 &error)); |
218 EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER)); | 214 EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER)); |
219 | 215 |
220 EXPECT_TRUE(HasExperimentLabels(HKEY_CURRENT_USER)); | 216 EXPECT_TRUE(HasExperimentLabels(HKEY_CURRENT_USER)); |
221 } | 217 } |
OLD | NEW |