| 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/gdata/gdata_sync_client.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_sync_client.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 // Action used to set mock expectations for GetFileByResourceId(). | 142 // Action used to set mock expectations for GetFileByResourceId(). |
| 143 ACTION_P4(MockGetFileByResourceId, error, local_path, mime_type, file_type) { | 143 ACTION_P4(MockGetFileByResourceId, error, local_path, mime_type, file_type) { |
| 144 arg1.Run(error, local_path, mime_type, file_type); | 144 arg1.Run(error, local_path, mime_type, file_type); |
| 145 } | 145 } |
| 146 | 146 |
| 147 TEST_F(GDataSyncClientTest, StartInitialScan) { | 147 TEST_F(GDataSyncClientTest, StartInitialScan) { |
| 148 SetUpTestFiles(); | 148 SetUpTestFiles(); |
| 149 | 149 |
| 150 EXPECT_CALL(*mock_file_system_, GetGDataCachePinnedDirectory()) | 150 EXPECT_CALL(*mock_file_system_, GetCacheDirectoryPath( |
| 151 GDataRootDirectory::CACHE_TYPE_PINNED)) |
| 151 .WillOnce(Return(temp_dir_.path())); | 152 .WillOnce(Return(temp_dir_.path())); |
| 152 | 153 |
| 153 sync_client_->StartInitialScan( | 154 sync_client_->StartInitialScan( |
| 154 base::Bind(&GDataSyncClientTest::OnInitialScanComplete, | 155 base::Bind(&GDataSyncClientTest::OnInitialScanComplete, |
| 155 base::Unretained(this))); | 156 base::Unretained(this))); |
| 156 // Wait until the initial scan is complete. | 157 // Wait until the initial scan is complete. |
| 157 message_loop_.Run(); | 158 message_loop_.Run(); |
| 158 | 159 |
| 159 // Check the contents of the queue. | 160 // Check the contents of the queue. |
| 160 const std::deque<std::string>& resource_ids = | 161 const std::deque<std::string>& resource_ids = |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 ASSERT_EQ(1U, resource_ids.size()); | 331 ASSERT_EQ(1U, resource_ids.size()); |
| 331 EXPECT_EQ("resource_id_not_fetched_baz", resource_ids[1]); | 332 EXPECT_EQ("resource_id_not_fetched_baz", resource_ids[1]); |
| 332 | 333 |
| 333 sync_client_->OnFileUnpinned("resource_id_not_fetched_baz", "md5"); | 334 sync_client_->OnFileUnpinned("resource_id_not_fetched_baz", "md5"); |
| 334 // "baz" should be gone. | 335 // "baz" should be gone. |
| 335 resource_ids = sync_client_->GetResourceIdsForTesting(); | 336 resource_ids = sync_client_->GetResourceIdsForTesting(); |
| 336 ASSERT_TRUE(resource_ids.empty()); | 337 ASSERT_TRUE(resource_ids.empty()); |
| 337 } | 338 } |
| 338 | 339 |
| 339 } // namespace gdata | 340 } // namespace gdata |
| OLD | NEW |