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

Side by Side Diff: chrome/browser/chromeos/drive/sync/entry_update_performer_unittest.cc

Issue 439713003: Drop prefixes from test data resource IDs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 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/sync/entry_update_performer.h" 5 #include "chrome/browser/chromeos/drive/sync/entry_update_performer.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/md5.h" 9 #include "base/md5.h"
10 #include "base/task_runner_util.h" 10 #include "base/task_runner_util.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 FileError error = FILE_ERROR_FAILED; 188 FileError error = FILE_ERROR_FAILED;
189 performer_->UpdateEntry( 189 performer_->UpdateEntry(
190 id, ClientContext(USER_INITIATED), 190 id, ClientContext(USER_INITIATED),
191 google_apis::test_util::CreateCopyResultCallback(&error)); 191 google_apis::test_util::CreateCopyResultCallback(&error));
192 content::RunAllBlockingPoolTasksUntilIdle(); 192 content::RunAllBlockingPoolTasksUntilIdle();
193 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error); 193 EXPECT_EQ(FILE_ERROR_NOT_FOUND, error);
194 } 194 }
195 195
196 TEST_F(EntryUpdatePerformerTest, UpdateEntry_ContentUpdate) { 196 TEST_F(EntryUpdatePerformerTest, UpdateEntry_ContentUpdate) {
197 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt")); 197 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt"));
198 const std::string kResourceId("file:2_file_resource_id"); 198 const std::string kResourceId("2_file_resource_id");
199 199
200 const std::string local_id = GetLocalId(kFilePath); 200 const std::string local_id = GetLocalId(kFilePath);
201 EXPECT_FALSE(local_id.empty()); 201 EXPECT_FALSE(local_id.empty());
202 202
203 const std::string kTestFileContent = "I'm being uploaded! Yay!"; 203 const std::string kTestFileContent = "I'm being uploaded! Yay!";
204 EXPECT_EQ(FILE_ERROR_OK, StoreAndMarkDirty(local_id, kTestFileContent)); 204 EXPECT_EQ(FILE_ERROR_OK, StoreAndMarkDirty(local_id, kTestFileContent));
205 205
206 int64 original_changestamp = 206 int64 original_changestamp =
207 fake_service()->about_resource().largest_change_id(); 207 fake_service()->about_resource().largest_change_id();
208 208
(...skipping 23 matching lines...) Expand all
232 server_entry->file_size()); 232 server_entry->file_size());
233 233
234 // Make sure that the cache is no longer dirty. 234 // Make sure that the cache is no longer dirty.
235 ResourceEntry entry; 235 ResourceEntry entry;
236 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kFilePath, &entry)); 236 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kFilePath, &entry));
237 EXPECT_FALSE(entry.file_specific_info().cache_state().is_dirty()); 237 EXPECT_FALSE(entry.file_specific_info().cache_state().is_dirty());
238 } 238 }
239 239
240 TEST_F(EntryUpdatePerformerTest, UpdateEntry_ContentUpdateMd5Check) { 240 TEST_F(EntryUpdatePerformerTest, UpdateEntry_ContentUpdateMd5Check) {
241 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt")); 241 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt"));
242 const std::string kResourceId("file:2_file_resource_id"); 242 const std::string kResourceId("2_file_resource_id");
243 243
244 const std::string local_id = GetLocalId(kFilePath); 244 const std::string local_id = GetLocalId(kFilePath);
245 EXPECT_FALSE(local_id.empty()); 245 EXPECT_FALSE(local_id.empty());
246 246
247 const std::string kTestFileContent = "I'm being uploaded! Yay!"; 247 const std::string kTestFileContent = "I'm being uploaded! Yay!";
248 EXPECT_EQ(FILE_ERROR_OK, StoreAndMarkDirty(local_id, kTestFileContent)); 248 EXPECT_EQ(FILE_ERROR_OK, StoreAndMarkDirty(local_id, kTestFileContent));
249 249
250 int64 original_changestamp = 250 int64 original_changestamp =
251 fake_service()->about_resource().largest_change_id(); 251 fake_service()->about_resource().largest_change_id();
252 252
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 EXPECT_EQ(original_changestamp, 310 EXPECT_EQ(original_changestamp,
311 fake_service()->about_resource().largest_change_id()); 311 fake_service()->about_resource().largest_change_id());
312 312
313 // Make sure that the cache is no longer dirty. 313 // Make sure that the cache is no longer dirty.
314 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kFilePath, &entry)); 314 EXPECT_EQ(FILE_ERROR_OK, GetLocalResourceEntry(kFilePath, &entry));
315 EXPECT_FALSE(entry.file_specific_info().cache_state().is_dirty()); 315 EXPECT_FALSE(entry.file_specific_info().cache_state().is_dirty());
316 } 316 }
317 317
318 TEST_F(EntryUpdatePerformerTest, UpdateEntry_OpenedForWrite) { 318 TEST_F(EntryUpdatePerformerTest, UpdateEntry_OpenedForWrite) {
319 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt")); 319 const base::FilePath kFilePath(FILE_PATH_LITERAL("drive/root/File 1.txt"));
320 const std::string kResourceId("file:2_file_resource_id"); 320 const std::string kResourceId("2_file_resource_id");
321 321
322 const std::string local_id = GetLocalId(kFilePath); 322 const std::string local_id = GetLocalId(kFilePath);
323 EXPECT_FALSE(local_id.empty()); 323 EXPECT_FALSE(local_id.empty());
324 324
325 const std::string kTestFileContent = "I'm being uploaded! Yay!"; 325 const std::string kTestFileContent = "I'm being uploaded! Yay!";
326 EXPECT_EQ(FILE_ERROR_OK, StoreAndMarkDirty(local_id, kTestFileContent)); 326 EXPECT_EQ(FILE_ERROR_OK, StoreAndMarkDirty(local_id, kTestFileContent));
327 327
328 // Emulate a situation where someone is writing to the file. 328 // Emulate a situation where someone is writing to the file.
329 scoped_ptr<base::ScopedClosureRunner> file_closer; 329 scoped_ptr<base::ScopedClosureRunner> file_closer;
330 FileError error = FILE_ERROR_FAILED; 330 FileError error = FILE_ERROR_FAILED;
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 entry.resource_id(), 546 entry.resource_id(),
547 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry)); 547 google_apis::test_util::CreateCopyResultCallback(&status, &server_entry));
548 content::RunAllBlockingPoolTasksUntilIdle(); 548 content::RunAllBlockingPoolTasksUntilIdle();
549 EXPECT_EQ(google_apis::HTTP_SUCCESS, status); 549 EXPECT_EQ(google_apis::HTTP_SUCCESS, status);
550 ASSERT_TRUE(server_entry); 550 ASSERT_TRUE(server_entry);
551 EXPECT_TRUE(server_entry->IsDirectory()); 551 EXPECT_TRUE(server_entry->IsDirectory());
552 } 552 }
553 553
554 } // namespace internal 554 } // namespace internal
555 } // namespace drive 555 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/resource_metadata_unittest.cc ('k') | chrome/browser/drive/fake_drive_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698