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

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

Issue 881403003: Rename gdata_errorcode.h to drive_api_error_codes.h (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix typos in BUILD.gn Created 5 years, 10 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
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/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/files/scoped_temp_dir.h" 8 #include "base/files/scoped_temp_dir.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/testing_pref_service.h" 10 #include "base/prefs/testing_pref_service.h"
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 new ChangeListLoader(logger_.get(), 103 new ChangeListLoader(logger_.get(),
104 base::MessageLoopProxy::current().get(), 104 base::MessageLoopProxy::current().get(),
105 metadata_.get(), 105 metadata_.get(),
106 scheduler_.get(), 106 scheduler_.get(),
107 about_resource_loader_.get(), 107 about_resource_loader_.get(),
108 loader_controller_.get())); 108 loader_controller_.get()));
109 } 109 }
110 110
111 // Adds a new file to the root directory of the service. 111 // Adds a new file to the root directory of the service.
112 scoped_ptr<google_apis::FileResource> AddNewFile(const std::string& title) { 112 scoped_ptr<google_apis::FileResource> AddNewFile(const std::string& title) {
113 google_apis::GDataErrorCode error = google_apis::GDATA_FILE_ERROR; 113 google_apis::DriveApiErrorCode error = google_apis::DRIVE_FILE_ERROR;
114 scoped_ptr<google_apis::FileResource> entry; 114 scoped_ptr<google_apis::FileResource> entry;
115 drive_service_->AddNewFile( 115 drive_service_->AddNewFile(
116 "text/plain", 116 "text/plain",
117 "content text", 117 "content text",
118 drive_service_->GetRootResourceId(), 118 drive_service_->GetRootResourceId(),
119 title, 119 title,
120 false, // shared_with_me 120 false, // shared_with_me
121 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 121 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
122 base::RunLoop().RunUntilIdle(); 122 base::RunLoop().RunUntilIdle();
123 EXPECT_EQ(google_apis::HTTP_CREATED, error); 123 EXPECT_EQ(google_apis::HTTP_CREATED, error);
124 return entry.Pass(); 124 return entry.Pass();
125 } 125 }
126 126
127 content::TestBrowserThreadBundle thread_bundle_; 127 content::TestBrowserThreadBundle thread_bundle_;
128 base::ScopedTempDir temp_dir_; 128 base::ScopedTempDir temp_dir_;
129 scoped_ptr<TestingPrefServiceSimple> pref_service_; 129 scoped_ptr<TestingPrefServiceSimple> pref_service_;
130 scoped_ptr<EventLogger> logger_; 130 scoped_ptr<EventLogger> logger_;
131 scoped_ptr<FakeDriveService> drive_service_; 131 scoped_ptr<FakeDriveService> drive_service_;
132 scoped_ptr<JobScheduler> scheduler_; 132 scoped_ptr<JobScheduler> scheduler_;
133 scoped_ptr<ResourceMetadataStorage, 133 scoped_ptr<ResourceMetadataStorage,
134 test_util::DestroyHelperForTests> metadata_storage_; 134 test_util::DestroyHelperForTests> metadata_storage_;
135 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_; 135 scoped_ptr<FileCache, test_util::DestroyHelperForTests> cache_;
136 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests> metadata_; 136 scoped_ptr<ResourceMetadata, test_util::DestroyHelperForTests> metadata_;
137 scoped_ptr<AboutResourceLoader> about_resource_loader_; 137 scoped_ptr<AboutResourceLoader> about_resource_loader_;
138 scoped_ptr<LoaderController> loader_controller_; 138 scoped_ptr<LoaderController> loader_controller_;
139 scoped_ptr<ChangeListLoader> change_list_loader_; 139 scoped_ptr<ChangeListLoader> change_list_loader_;
140 }; 140 };
141 141
142 TEST_F(ChangeListLoaderTest, AboutResourceLoader) { 142 TEST_F(ChangeListLoaderTest, AboutResourceLoader) {
143 google_apis::GDataErrorCode error[6] = {}; 143 google_apis::DriveApiErrorCode error[6] = {};
144 scoped_ptr<google_apis::AboutResource> about[6]; 144 scoped_ptr<google_apis::AboutResource> about[6];
145 145
146 // No resource is cached at the beginning. 146 // No resource is cached at the beginning.
147 ASSERT_FALSE(about_resource_loader_->cached_about_resource()); 147 ASSERT_FALSE(about_resource_loader_->cached_about_resource());
148 148
149 // Since no resource is cached, this "Get" should trigger the update. 149 // Since no resource is cached, this "Get" should trigger the update.
150 about_resource_loader_->GetAboutResource( 150 about_resource_loader_->GetAboutResource(
151 google_apis::test_util::CreateCopyResultCallback(error + 0, about + 0)); 151 google_apis::test_util::CreateCopyResultCallback(error + 0, about + 0));
152 // Since there is one in-flight update, the next "Get" just wait for it. 152 // Since there is one in-flight update, the next "Get" just wait for it.
153 about_resource_loader_->GetAboutResource( 153 about_resource_loader_->GetAboutResource(
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 389
390 // Unlock the loader, this should resume the pending update. 390 // Unlock the loader, this should resume the pending update.
391 lock.reset(); 391 lock.reset();
392 base::RunLoop().RunUntilIdle(); 392 base::RunLoop().RunUntilIdle();
393 EXPECT_TRUE( 393 EXPECT_TRUE(
394 observer.changed_files().CountDirectory(util::GetDriveMyDriveRootPath())); 394 observer.changed_files().CountDirectory(util::GetDriveMyDriveRootPath()));
395 } 395 }
396 396
397 } // namespace internal 397 } // namespace internal
398 } // namespace drive 398 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698