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

Side by Side Diff: chrome/installer/gcapi/gcapi_last_run_test.cc

Issue 2692843002: Fail tests fast if overriding the Windows registry fails. (Closed)
Patch Set: sync to position 450085 Created 3 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 unified diff | Download patch
« no previous file with comments | « chrome/installer/gcapi/BUILD.gn ('k') | chrome/installer/gcapi/gcapi_omaha_experiment_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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> 5 #include <stdint.h>
6 6
7 #include <limits> 7 #include <limits>
8 #include <string> 8 #include <string>
9 9
10 #include "base/guid.h" 10 #include "base/guid.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/strings/utf_string_conversions.h" 12 #include "base/strings/utf_string_conversions.h"
13 #include "base/test/test_reg_util_win.h" 13 #include "base/test/test_reg_util_win.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "base/win/registry.h" 15 #include "base/win/registry.h"
16 #include "chrome/installer/gcapi/gcapi.h" 16 #include "chrome/installer/gcapi/gcapi.h"
17 #include "chrome/installer/util/google_update_constants.h" 17 #include "chrome/installer/util/google_update_constants.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 19
20 using base::Time; 20 using base::Time;
21 using base::TimeDelta; 21 using base::TimeDelta;
22 using base::win::RegKey; 22 using base::win::RegKey;
23 23
24 24
25 class GCAPILastRunTest : public ::testing::Test { 25 class GCAPILastRunTest : public ::testing::Test {
26 protected: 26 protected:
27 void SetUp() override { 27 void SetUp() override {
28 // Override keys - this is undone during destruction. 28 // Override keys - this is undone during destruction.
29 override_manager_.OverrideRegistry(HKEY_CURRENT_USER); 29 ASSERT_NO_FATAL_FAILURE(
30 override_manager_.OverrideRegistry(HKEY_CURRENT_USER));
30 31
31 // Create the client state key in the right places. 32 // Create the client state key in the right places.
32 std::wstring reg_path(google_update::kRegPathClientState); 33 std::wstring reg_path(google_update::kRegPathClientState);
33 reg_path += L"\\"; 34 reg_path += L"\\";
34 reg_path += google_update::kChromeUpgradeCode; 35 reg_path += google_update::kChromeUpgradeCode;
35 RegKey client_state(HKEY_CURRENT_USER, 36 RegKey client_state(HKEY_CURRENT_USER,
36 reg_path.c_str(), 37 reg_path.c_str(),
37 KEY_CREATE_SUB_KEY | KEY_WOW64_32KEY); 38 KEY_CREATE_SUB_KEY | KEY_WOW64_32KEY);
38 ASSERT_TRUE(client_state.Valid()); 39 ASSERT_TRUE(client_state.Valid());
39 40
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 EXPECT_EQ(-1, days_since_last_run); 91 EXPECT_EQ(-1, days_since_last_run);
91 } 92 }
92 93
93 TEST_F(GCAPILastRunTest, OutOfRangeLastRun) { 94 TEST_F(GCAPILastRunTest, OutOfRangeLastRun) {
94 Time last_run = Time::NowFromSystemTime() - TimeDelta::FromDays(-42); 95 Time last_run = Time::NowFromSystemTime() - TimeDelta::FromDays(-42);
95 EXPECT_TRUE(SetLastRunTime(last_run.ToInternalValue())); 96 EXPECT_TRUE(SetLastRunTime(last_run.ToInternalValue()));
96 97
97 int days_since_last_run = GoogleChromeDaysSinceLastRun(); 98 int days_since_last_run = GoogleChromeDaysSinceLastRun();
98 EXPECT_EQ(-1, days_since_last_run); 99 EXPECT_EQ(-1, days_since_last_run);
99 } 100 }
OLDNEW
« no previous file with comments | « chrome/installer/gcapi/BUILD.gn ('k') | chrome/installer/gcapi/gcapi_omaha_experiment_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698