| 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 // StorageInfoProviderLinux unit tests. | 5 // StorageInfoProviderLinux unit tests. |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide
r_linux.h" | 7 #include "chrome/browser/extensions/api/system_info_storage/storage_info_provide
r_linux.h" |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 | 10 |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // Create and set up a temp file for mtab data. | 102 // Create and set up a temp file for mtab data. |
| 103 ASSERT_TRUE(file_util::CreateTemporaryFile(&mtab_file_)); | 103 ASSERT_TRUE(file_util::CreateTemporaryFile(&mtab_file_)); |
| 104 int bytes = file_util::WriteFile(mtab_file_, mtab_test_data, | 104 int bytes = file_util::WriteFile(mtab_file_, mtab_test_data, |
| 105 strlen(mtab_test_data)); | 105 strlen(mtab_test_data)); |
| 106 ASSERT_EQ(static_cast<int>(strlen(mtab_test_data)), bytes); | 106 ASSERT_EQ(static_cast<int>(strlen(mtab_test_data)), bytes); |
| 107 test_storage_notifications_.reset(new TestStorageMonitor); | 107 test_storage_notifications_.reset(new TestStorageMonitor); |
| 108 storage_info_provider_ = new StorageInfoProviderLinuxWrapper(mtab_file_); | 108 storage_info_provider_ = new StorageInfoProviderLinuxWrapper(mtab_file_); |
| 109 } | 109 } |
| 110 | 110 |
| 111 virtual void TearDown() OVERRIDE { | 111 virtual void TearDown() OVERRIDE { |
| 112 file_util::Delete(mtab_file_, false); | 112 base::Delete(mtab_file_, false); |
| 113 } | 113 } |
| 114 | 114 |
| 115 scoped_refptr<StorageInfoProviderLinuxWrapper> storage_info_provider_; | 115 scoped_refptr<StorageInfoProviderLinuxWrapper> storage_info_provider_; |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 base::FilePath mtab_file_; | 118 base::FilePath mtab_file_; |
| 119 scoped_ptr<TestStorageMonitor> test_storage_notifications_; | 119 scoped_ptr<TestStorageMonitor> test_storage_notifications_; |
| 120 }; | 120 }; |
| 121 | 121 |
| 122 TEST_F(StorageInfoProviderLinuxTest, QueryInfo) { | 122 TEST_F(StorageInfoProviderLinuxTest, QueryInfo) { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 140 TEST_F(StorageInfoProviderLinuxTest, QueryInfoFailed) { | 140 TEST_F(StorageInfoProviderLinuxTest, QueryInfoFailed) { |
| 141 storage_info_provider_ = | 141 storage_info_provider_ = |
| 142 new StorageInfoProviderLinuxWrapper(base::FilePath("/invalid/file/path")); | 142 new StorageInfoProviderLinuxWrapper(base::FilePath("/invalid/file/path")); |
| 143 StorageInfo info; | 143 StorageInfo info; |
| 144 ASSERT_FALSE(QueryInfo(&info)); | 144 ASSERT_FALSE(QueryInfo(&info)); |
| 145 EXPECT_EQ(0u, info.size()); | 145 EXPECT_EQ(0u, info.size()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 } // namespace extensions | 148 } // namespace extensions |
| 149 | 149 |
| OLD | NEW |