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 "chrome/browser/chromeos/drive/drive_prefetcher.h" | 5 #include "chrome/browser/chromeos/drive/drive_prefetcher.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 EXPECT_CALL(*mock_file_system_, GetFileByResourceId(_, _, _, _)).Times(0); | 176 EXPECT_CALL(*mock_file_system_, GetFileByResourceId(_, _, _, _)).Times(0); |
177 EXPECT_CALL(*mock_file_system_, GetFileByResourceId(_, _, _, _)) | 177 EXPECT_CALL(*mock_file_system_, GetFileByResourceId(_, _, _, _)) |
178 .WillRepeatedly(MockGetFile(&fetched_list)); | 178 .WillRepeatedly(MockGetFile(&fetched_list)); |
179 prefetcher_->OnInitialLoadFinished(); | 179 prefetcher_->OnInitialLoadFinished(); |
180 RunMessageLoop(); | 180 RunMessageLoop(); |
181 EXPECT_EQ(expected, fetched_list); | 181 EXPECT_EQ(expected, fetched_list); |
182 } | 182 } |
183 | 183 |
184 scoped_ptr<StrictMock<MockDriveFileSystem> > mock_file_system_; | 184 scoped_ptr<StrictMock<MockDriveFileSystem> > mock_file_system_; |
185 scoped_ptr<DrivePrefetcher> prefetcher_; | 185 scoped_ptr<DrivePrefetcher> prefetcher_; |
186 MessageLoopForUI message_loop_; | 186 base::MessageLoopForUI message_loop_; |
187 content::TestBrowserThread ui_thread_; | 187 content::TestBrowserThread ui_thread_; |
188 }; | 188 }; |
189 | 189 |
190 TEST_F(DrivePrefetcherTest, ZeroFiles) { | 190 TEST_F(DrivePrefetcherTest, ZeroFiles) { |
191 InitPrefetcher(3, 100); | 191 InitPrefetcher(3, 100); |
192 VerifyFullScan( | 192 VerifyFullScan( |
193 std::vector<TestEntry>(kEmptyDrive, | 193 std::vector<TestEntry>(kEmptyDrive, |
194 kEmptyDrive + arraysize(kEmptyDrive)), | 194 kEmptyDrive + arraysize(kEmptyDrive)), |
195 std::vector<std::string>()); | 195 std::vector<std::string>()); |
196 } | 196 } |
(...skipping 22 matching lines...) Expand all Loading... |
219 // This is checked by setting the fetch limit larger than the number of files. | 219 // This is checked by setting the fetch limit larger than the number of files. |
220 InitPrefetcher(100, 99999999); | 220 InitPrefetcher(100, 99999999); |
221 VerifyFullScan( | 221 VerifyFullScan( |
222 std::vector<TestEntry>(kComplexDrive, | 222 std::vector<TestEntry>(kComplexDrive, |
223 kComplexDrive + arraysize(kComplexDrive)), | 223 kComplexDrive + arraysize(kComplexDrive)), |
224 std::vector<std::string>(kAllRegularFiles, | 224 std::vector<std::string>(kAllRegularFiles, |
225 kAllRegularFiles + arraysize(kAllRegularFiles))); | 225 kAllRegularFiles + arraysize(kAllRegularFiles))); |
226 } | 226 } |
227 | 227 |
228 } // namespace drive | 228 } // namespace drive |
OLD | NEW |