| 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 <stdint.h> |
| 6 |
| 5 #include <string> | 7 #include <string> |
| 6 | 8 |
| 7 #include "base/basictypes.h" | |
| 8 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| 10 #include "base/win/registry.h" | 11 #include "base/win/registry.h" |
| 11 #include "chrome/installer/gcapi/gcapi.h" | 12 #include "chrome/installer/gcapi/gcapi.h" |
| 12 #include "chrome/installer/gcapi/gcapi_omaha_experiment.h" | 13 #include "chrome/installer/gcapi/gcapi_omaha_experiment.h" |
| 13 #include "chrome/installer/gcapi/gcapi_reactivation.h" | 14 #include "chrome/installer/gcapi/gcapi_reactivation.h" |
| 14 #include "chrome/installer/gcapi/gcapi_test_registry_overrider.h" | 15 #include "chrome/installer/gcapi/gcapi_test_registry_overrider.h" |
| 15 #include "chrome/installer/util/google_update_constants.h" | 16 #include "chrome/installer/util/google_update_constants.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 29 reg_path += L"\\"; | 30 reg_path += L"\\"; |
| 30 reg_path += google_update::kChromeUpgradeCode; | 31 reg_path += google_update::kChromeUpgradeCode; |
| 31 RegKey client_state(hive, | 32 RegKey client_state(hive, |
| 32 reg_path.c_str(), | 33 reg_path.c_str(), |
| 33 KEY_CREATE_SUB_KEY | KEY_SET_VALUE | KEY_WOW64_32KEY); | 34 KEY_CREATE_SUB_KEY | KEY_SET_VALUE | KEY_WOW64_32KEY); |
| 34 return (client_state.Valid() && | 35 return (client_state.Valid() && |
| 35 client_state.WriteValue( | 36 client_state.WriteValue( |
| 36 google_update::kRegVersionField, L"1.2.3.4") == ERROR_SUCCESS); | 37 google_update::kRegVersionField, L"1.2.3.4") == ERROR_SUCCESS); |
| 37 } | 38 } |
| 38 | 39 |
| 39 bool SetLastRunTime(HKEY hive, int64 last_run_time) { | 40 bool SetLastRunTime(HKEY hive, int64_t last_run_time) { |
| 40 return SetLastRunTimeString(hive, base::Int64ToString16(last_run_time)); | 41 return SetLastRunTimeString(hive, base::Int64ToString16(last_run_time)); |
| 41 } | 42 } |
| 42 | 43 |
| 43 bool SetLastRunTimeString(HKEY hive, | 44 bool SetLastRunTimeString(HKEY hive, |
| 44 const base::string16& last_run_time_string) { | 45 const base::string16& last_run_time_string) { |
| 45 const wchar_t* base_path = | 46 const wchar_t* base_path = |
| 46 (hive == HKEY_LOCAL_MACHINE) ? | 47 (hive == HKEY_LOCAL_MACHINE) ? |
| 47 google_update::kRegPathClientStateMedium : | 48 google_update::kRegPathClientStateMedium : |
| 48 google_update::kRegPathClientState; | 49 google_update::kRegPathClientState; |
| 49 std::wstring path(base_path); | 50 std::wstring path(base_path); |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER, | 201 EXPECT_TRUE(SetLastRunTime(HKEY_CURRENT_USER, |
| 201 hkcu_last_run.ToInternalValue())); | 202 hkcu_last_run.ToInternalValue())); |
| 202 | 203 |
| 203 EXPECT_TRUE(ReactivateChrome(L"GAGA", | 204 EXPECT_TRUE(ReactivateChrome(L"GAGA", |
| 204 GCAPI_INVOKED_STANDARD_SHELL, | 205 GCAPI_INVOKED_STANDARD_SHELL, |
| 205 &error)); | 206 &error)); |
| 206 EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER)); | 207 EXPECT_EQ(L"GAGA", GetReactivationString(HKEY_CURRENT_USER)); |
| 207 | 208 |
| 208 EXPECT_TRUE(HasExperimentLabels(HKEY_CURRENT_USER)); | 209 EXPECT_TRUE(HasExperimentLabels(HKEY_CURRENT_USER)); |
| 209 } | 210 } |
| OLD | NEW |