| 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/test/scoped_path_override.h" | 9 #include "base/test/scoped_path_override.h" |
| 10 #include "chrome/browser/google/google_brand.h" | 10 #include "chrome/browser/google/google_brand.h" |
| 11 #include "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome/installer/util/google_update_settings.h" | 12 #include "chrome/installer/util/google_update_settings.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
| 15 | 15 |
| 16 class GoogleUpdateTest : public PlatformTest { | 16 class GoogleUpdateTest : public PlatformTest { |
| 17 protected: | 17 protected: |
| 18 GoogleUpdateTest() : user_data_dir_override_(chrome::DIR_USER_DATA) {} | 18 GoogleUpdateTest() : user_data_dir_override_(chrome::DIR_USER_DATA) {} |
| 19 virtual ~GoogleUpdateTest() {} | 19 ~GoogleUpdateTest() override {} |
| 20 | 20 |
| 21 private: | 21 private: |
| 22 base::ScopedPathOverride user_data_dir_override_; | 22 base::ScopedPathOverride user_data_dir_override_; |
| 23 | 23 |
| 24 DISALLOW_COPY_AND_ASSIGN(GoogleUpdateTest); | 24 DISALLOW_COPY_AND_ASSIGN(GoogleUpdateTest); |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 TEST_F(GoogleUpdateTest, StatsConsent) { | 27 TEST_F(GoogleUpdateTest, StatsConsent) { |
| 28 // Stats are off by default. | 28 // Stats are off by default. |
| 29 EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent()); | 29 EXPECT_FALSE(GoogleUpdateSettings::GetCollectStatsConsent()); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_dir)); | 74 ASSERT_TRUE(PathService::Get(chrome::DIR_USER_DATA, &consent_dir)); |
| 75 ASSERT_TRUE(base::DirectoryExists(consent_dir)); | 75 ASSERT_TRUE(base::DirectoryExists(consent_dir)); |
| 76 | 76 |
| 77 base::FilePath consent_file = consent_dir.Append("Consent To Send Stats"); | 77 base::FilePath consent_file = consent_dir.Append("Consent To Send Stats"); |
| 78 ASSERT_TRUE(base::PathExists(consent_file)); | 78 ASSERT_TRUE(base::PathExists(consent_file)); |
| 79 int permissions; | 79 int permissions; |
| 80 ASSERT_TRUE(base::GetPosixFilePermissions(consent_file, &permissions)); | 80 ASSERT_TRUE(base::GetPosixFilePermissions(consent_file, &permissions)); |
| 81 EXPECT_TRUE(permissions & base::FILE_PERMISSION_READ_BY_OTHERS); | 81 EXPECT_TRUE(permissions & base::FILE_PERMISSION_READ_BY_OTHERS); |
| 82 } | 82 } |
| 83 #endif | 83 #endif |
| OLD | NEW |