google_update_settings_unittest.cc revision bda42a81ee5f9b20d2bebedcf0bbef1e30e5b293
1// Copyright (c) 2009 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chrome/installer/util/google_update_settings.h" 6#include "testing/gtest/include/gtest/gtest.h" 7#include "testing/platform_test.h" 8 9class GoogleUpdateTest : public PlatformTest { 10}; 11 12TEST_F(GoogleUpdateTest, StatsConstent) { 13 // Stats are off by default. 14 EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent()); 15 // Stats reporting is ON. 16 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(true)); 17 EXPECT_TRUE(GoogleUpdateSettings::GetCollectStatsConsent()); 18 // Stats reporting is OFF. 19 EXPECT_TRUE(GoogleUpdateSettings::SetCollectStatsConsent(false)); 20 EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent()); 21} 22 23#if defined(OS_WIN) 24 25TEST_F(GoogleUpdateTest, LastRunTime) { 26 // Querying the value that does not exists should fail. 27 EXPECT_TRUE(GoogleUpdateSettings::RemoveLastRunTime()); 28 EXPECT_EQ(-1, GoogleUpdateSettings::GetLastRunTime()); 29 // Setting and querying the last update time in fast sequence 30 // should give 0 days. 31 EXPECT_TRUE(GoogleUpdateSettings::SetLastRunTime()); 32 EXPECT_EQ(0, GoogleUpdateSettings::GetLastRunTime()); 33} 34 35#endif // defined(OS_WIN) 36