Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(400)

Side by Side Diff: chrome/browser/chromeos/drive/sync_client_unittest.cc

Issue 17004011: drive: DriveIntegrationService owns ResourceMetadataStorage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/sync_client.h" 5 #include "chrome/browser/chromeos/drive/sync_client.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 79 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
80 80
81 profile_.reset(new TestingProfile); 81 profile_.reset(new TestingProfile);
82 82
83 drive_service_.reset(new SyncClientTestDriveService); 83 drive_service_.reset(new SyncClientTestDriveService);
84 drive_service_->LoadResourceListForWapi("chromeos/gdata/empty_feed.json"); 84 drive_service_->LoadResourceListForWapi("chromeos/gdata/empty_feed.json");
85 drive_service_->LoadAccountMetadataForWapi( 85 drive_service_->LoadAccountMetadataForWapi(
86 "chromeos/gdata/account_metadata.json"); 86 "chromeos/gdata/account_metadata.json");
87 87
88 scheduler_.reset(new JobScheduler(profile_.get(), drive_service_.get())); 88 scheduler_.reset(new JobScheduler(profile_.get(), drive_service_.get()));
89
90 metadata_storage_.reset(new ResourceMetadataStorage(
91 temp_dir_.path(), base::MessageLoopProxy::current()));
92 ASSERT_TRUE(metadata_storage_->Initialize());
93
89 metadata_.reset(new internal::ResourceMetadata( 94 metadata_.reset(new internal::ResourceMetadata(
90 temp_dir_.path(), base::MessageLoopProxy::current())); 95 metadata_storage_.get(), base::MessageLoopProxy::current()));
91 ASSERT_EQ(FILE_ERROR_OK, metadata_->Initialize()); 96 ASSERT_EQ(FILE_ERROR_OK, metadata_->Initialize());
92 97
93 cache_.reset(new FileCache(temp_dir_.path(), 98 cache_.reset(new FileCache(temp_dir_.path(),
94 temp_dir_.path(), 99 temp_dir_.path(),
95 base::MessageLoopProxy::current(), 100 base::MessageLoopProxy::current(),
96 NULL /* free_disk_space_getter */)); 101 NULL /* free_disk_space_getter */));
97 ASSERT_TRUE(cache_->Initialize()); 102 ASSERT_TRUE(cache_->Initialize());
98 103
99 ASSERT_NO_FATAL_FAILURE(SetUpTestData()); 104 ASSERT_NO_FATAL_FAILURE(SetUpTestData());
100 105
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 EXPECT_EQ(FILE_ERROR_OK, error); 185 EXPECT_EQ(FILE_ERROR_OK, error);
181 } 186 }
182 187
183 protected: 188 protected:
184 content::TestBrowserThreadBundle thread_bundle_; 189 content::TestBrowserThreadBundle thread_bundle_;
185 base::ScopedTempDir temp_dir_; 190 base::ScopedTempDir temp_dir_;
186 scoped_ptr<TestingProfile> profile_; 191 scoped_ptr<TestingProfile> profile_;
187 scoped_ptr<SyncClientTestDriveService> drive_service_; 192 scoped_ptr<SyncClientTestDriveService> drive_service_;
188 DummyOperationObserver observer_; 193 DummyOperationObserver observer_;
189 scoped_ptr<JobScheduler> scheduler_; 194 scoped_ptr<JobScheduler> scheduler_;
190 scoped_ptr<internal::ResourceMetadata, test_util::DestroyHelperForTests> 195 scoped_ptr<ResourceMetadataStorage,
191 metadata_; 196 test_util::DestroyHelperForTests> metadata_storage_;
197 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests> metadata_;
192 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_; 198 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_;
193 scoped_ptr<SyncClient> sync_client_; 199 scoped_ptr<SyncClient> sync_client_;
194 200
195 std::map<std::string, std::string> resource_ids_; // Name-to-id map. 201 std::map<std::string, std::string> resource_ids_; // Name-to-id map.
196 }; 202 };
197 203
198 TEST_F(SyncClientTest, StartProcessingBacklog) { 204 TEST_F(SyncClientTest, StartProcessingBacklog) {
199 sync_client_->StartProcessingBacklog(); 205 sync_client_->StartProcessingBacklog();
200 base::RunLoop().RunUntilIdle(); 206 base::RunLoop().RunUntilIdle();
201 207
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 content.clear(); 289 content.clear();
284 290
285 EXPECT_EQ(FILE_ERROR_OK, cache_->GetFile(resource_ids_["dirty"], 291 EXPECT_EQ(FILE_ERROR_OK, cache_->GetFile(resource_ids_["dirty"],
286 std::string(), &cache_file)); 292 std::string(), &cache_file));
287 EXPECT_TRUE(file_util::ReadFileToString(cache_file, &content)); 293 EXPECT_TRUE(file_util::ReadFileToString(cache_file, &content));
288 EXPECT_EQ(kLocalContent, content); 294 EXPECT_EQ(kLocalContent, content);
289 } 295 }
290 296
291 } // namespace internal 297 } // namespace internal
292 } // namespace drive 298 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698