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

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

Issue 17004011: drive: DriveIntegrationService owns ResourceMetadataStorage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a nit 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/change_list_processor_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/change_list_loader.h" 5 #include "chrome/browser/chromeos/drive/change_list_loader.h"
6 6
7 #include "base/files/scoped_temp_dir.h" 7 #include "base/files/scoped_temp_dir.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "chrome/browser/chromeos/drive/file_cache.h" 10 #include "chrome/browser/chromeos/drive/file_cache.h"
(...skipping 15 matching lines...) Expand all
26 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 26 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
27 profile_.reset(new TestingProfile); 27 profile_.reset(new TestingProfile);
28 28
29 drive_service_.reset(new FakeDriveService); 29 drive_service_.reset(new FakeDriveService);
30 ASSERT_TRUE(drive_service_->LoadResourceListForWapi( 30 ASSERT_TRUE(drive_service_->LoadResourceListForWapi(
31 "chromeos/gdata/root_feed.json")); 31 "chromeos/gdata/root_feed.json"));
32 ASSERT_TRUE(drive_service_->LoadAccountMetadataForWapi( 32 ASSERT_TRUE(drive_service_->LoadAccountMetadataForWapi(
33 "chromeos/gdata/account_metadata.json")); 33 "chromeos/gdata/account_metadata.json"));
34 34
35 scheduler_.reset(new JobScheduler(profile_.get(), drive_service_.get())); 35 scheduler_.reset(new JobScheduler(profile_.get(), drive_service_.get()));
36 metadata_.reset(new ResourceMetadata(temp_dir_.path(), 36 metadata_storage_.reset(new ResourceMetadataStorage(
37 temp_dir_.path(), base::MessageLoopProxy::current()));
38 ASSERT_TRUE(metadata_storage_->Initialize());
39
40 metadata_.reset(new ResourceMetadata(metadata_storage_.get(),
37 base::MessageLoopProxy::current())); 41 base::MessageLoopProxy::current()));
38 ASSERT_EQ(FILE_ERROR_OK, metadata_->Initialize()); 42 ASSERT_EQ(FILE_ERROR_OK, metadata_->Initialize());
39 43
40 cache_.reset(new FileCache(temp_dir_.path(), 44 cache_.reset(new FileCache(temp_dir_.path(),
41 temp_dir_.path(), 45 temp_dir_.path(),
42 base::MessageLoopProxy::current(), 46 base::MessageLoopProxy::current(),
43 NULL /* free_disk_space_getter */)); 47 NULL /* free_disk_space_getter */));
44 ASSERT_TRUE(cache_->Initialize()); 48 ASSERT_TRUE(cache_->Initialize());
45 49
46 change_list_loader_.reset(new ChangeListLoader( 50 change_list_loader_.reset(new ChangeListLoader(
47 base::MessageLoopProxy::current(), metadata_.get(), scheduler_.get())); 51 base::MessageLoopProxy::current(), metadata_.get(), scheduler_.get()));
48 } 52 }
49 53
50 content::TestBrowserThreadBundle thread_bundle_; 54 content::TestBrowserThreadBundle thread_bundle_;
51 base::ScopedTempDir temp_dir_; 55 base::ScopedTempDir temp_dir_;
52 scoped_ptr<TestingProfile> profile_; 56 scoped_ptr<TestingProfile> profile_;
53 scoped_ptr<FakeDriveService> drive_service_; 57 scoped_ptr<FakeDriveService> drive_service_;
54 scoped_ptr<JobScheduler> scheduler_; 58 scoped_ptr<JobScheduler> scheduler_;
59 scoped_ptr<ResourceMetadataStorage,
60 test_util::DestroyHelperForTests> metadata_storage_;
55 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests> metadata_; 61 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests> metadata_;
56 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_; 62 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_;
57 scoped_ptr<ChangeListLoader> change_list_loader_; 63 scoped_ptr<ChangeListLoader> change_list_loader_;
58 }; 64 };
59 65
60 TEST_F(ChangeListLoaderTest, LoadIfNeeded) { 66 TEST_F(ChangeListLoaderTest, LoadIfNeeded) {
61 EXPECT_FALSE(change_list_loader_->IsRefreshing()); 67 EXPECT_FALSE(change_list_loader_->IsRefreshing());
62 68
63 // Start initial load. 69 // Start initial load.
64 FileError error = FILE_ERROR_FAILED; 70 FileError error = FILE_ERROR_FAILED;
(...skipping 20 matching lines...) Expand all
85 EXPECT_EQ(FILE_ERROR_OK, error); 91 EXPECT_EQ(FILE_ERROR_OK, error);
86 92
87 EXPECT_FALSE(change_list_loader_->IsRefreshing()); 93 EXPECT_FALSE(change_list_loader_->IsRefreshing());
88 EXPECT_EQ(previous_changestamp, metadata_->GetLargestChangestamp()); 94 EXPECT_EQ(previous_changestamp, metadata_->GetLargestChangestamp());
89 EXPECT_EQ(previous_resource_list_load_count, 95 EXPECT_EQ(previous_resource_list_load_count,
90 drive_service_->resource_list_load_count()); 96 drive_service_->resource_list_load_count());
91 } 97 }
92 98
93 } // namespace internal 99 } // namespace internal
94 } // namespace drive 100 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/drive/change_list_processor_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698