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

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

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
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 <limits> 5 #include <limits>
6 #include <string> 6 #include <string>
7 7
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/guid.h" 9 #include "base/guid.h"
10 #include "base/stringprintf.h" 10 #include "base/stringprintf.h"
11 #include "base/strings/string_number_conversions.h" 11 #include "base/strings/string_number_conversions.h"
12 #include "base/test/test_reg_util_win.h" 12 #include "base/test/test_reg_util_win.h"
13 #include "base/time.h" 13 #include "base/time.h"
14 #include "base/utf_string_conversions.h" 14 #include "base/utf_string_conversions.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() { 27 void SetUp() {
28 // Override keys - this is undone during destruction. 28 // Override keys - this is undone during destruction.
29 std::wstring hkcu_override = base::StringPrintf( 29 std::wstring hkcu_override = base::StringPrintf(
30 L"hkcu_override\\%ls", ASCIIToWide(base::GenerateGUID())); 30 L"hkcu_override\\%ls", base::ASCIIToWide(base::GenerateGUID()));
31 override_manager_.OverrideRegistry(HKEY_CURRENT_USER, hkcu_override); 31 override_manager_.OverrideRegistry(HKEY_CURRENT_USER, hkcu_override);
32 32
33 // Create the client state key in the right places. 33 // Create the client state key in the right places.
34 std::wstring reg_path(google_update::kRegPathClientState); 34 std::wstring reg_path(google_update::kRegPathClientState);
35 reg_path += L"\\"; 35 reg_path += L"\\";
36 reg_path += google_update::kChromeUpgradeCode; 36 reg_path += google_update::kChromeUpgradeCode;
37 RegKey client_state(HKEY_CURRENT_USER, 37 RegKey client_state(HKEY_CURRENT_USER,
38 reg_path.c_str(), 38 reg_path.c_str(),
39 KEY_CREATE_SUB_KEY); 39 KEY_CREATE_SUB_KEY);
40 ASSERT_TRUE(client_state.Valid()); 40 ASSERT_TRUE(client_state.Valid());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 EXPECT_EQ(-1, days_since_last_run); 91 EXPECT_EQ(-1, days_since_last_run);
92 } 92 }
93 93
94 TEST_F(GCAPILastRunTest, OutOfRangeLastRun) { 94 TEST_F(GCAPILastRunTest, OutOfRangeLastRun) {
95 Time last_run = Time::NowFromSystemTime() - TimeDelta::FromDays(-42); 95 Time last_run = Time::NowFromSystemTime() - TimeDelta::FromDays(-42);
96 EXPECT_TRUE(SetLastRunTime(last_run.ToInternalValue())); 96 EXPECT_TRUE(SetLastRunTime(last_run.ToInternalValue()));
97 97
98 int days_since_last_run = GoogleChromeDaysSinceLastRun(); 98 int days_since_last_run = GoogleChromeDaysSinceLastRun();
99 EXPECT_EQ(-1, days_since_last_run); 99 EXPECT_EQ(-1, days_since_last_run);
100 } 100 }
OLDNEW
« no previous file with comments | « chrome/common/service_process_util_win.cc ('k') | chrome/installer/gcapi/gcapi_reactivation_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698