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

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

Issue 146833015: drive: FileCache::Store marks the entry as dirty if empty MD5 is given (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | 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 30 matching lines...) Expand all
41 !google_apis::test_util::WriteStringToFile(path, content)) 41 !google_apis::test_util::WriteStringToFile(path, content))
42 return FILE_ERROR_FAILED; 42 return FILE_ERROR_FAILED;
43 43
44 // Store the file to cache. 44 // Store the file to cache.
45 FileError error = FILE_ERROR_FAILED; 45 FileError error = FILE_ERROR_FAILED;
46 base::PostTaskAndReplyWithResult( 46 base::PostTaskAndReplyWithResult(
47 blocking_task_runner(), 47 blocking_task_runner(),
48 FROM_HERE, 48 FROM_HERE,
49 base::Bind(&FileCache::Store, 49 base::Bind(&FileCache::Store,
50 base::Unretained(cache()), 50 base::Unretained(cache()),
51 local_id, base::MD5String(content), path, 51 local_id, std::string(), path,
52 FileCache::FILE_OPERATION_COPY), 52 FileCache::FILE_OPERATION_COPY),
53 google_apis::test_util::CreateCopyResultCallback(&error)); 53 google_apis::test_util::CreateCopyResultCallback(&error));
54 test_util::RunBlockingPoolTask(); 54 test_util::RunBlockingPoolTask();
55 if (error != FILE_ERROR_OK)
56 return error;
57
58 // Add the dirty bit.
59 error = FILE_ERROR_FAILED;
60 scoped_ptr<base::ScopedClosureRunner> file_closer;
61 base::PostTaskAndReplyWithResult(
62 blocking_task_runner(),
63 FROM_HERE,
64 base::Bind(&FileCache::OpenForWrite,
65 base::Unretained(cache()),
66 local_id,
67 &file_closer),
68 google_apis::test_util::CreateCopyResultCallback(&error));
69 test_util::RunBlockingPoolTask();
70 return error; 55 return error;
71 } 56 }
72 57
73 scoped_ptr<EntryUpdatePerformer> performer_; 58 scoped_ptr<EntryUpdatePerformer> performer_;
74 }; 59 };
75 60
76 TEST_F(EntryUpdatePerformerTest, UpdateEntry) { 61 TEST_F(EntryUpdatePerformerTest, UpdateEntry) {
77 base::FilePath src_path( 62 base::FilePath src_path(
78 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt")); 63 FILE_PATH_LITERAL("drive/root/Directory 1/SubDirectory File 1.txt"));
79 base::FilePath dest_path( 64 base::FilePath dest_path(
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 local_id, 355 local_id,
371 &cache_entry), 356 &cache_entry),
372 google_apis::test_util::CreateCopyResultCallback(&success)); 357 google_apis::test_util::CreateCopyResultCallback(&success));
373 test_util::RunBlockingPoolTask(); 358 test_util::RunBlockingPoolTask();
374 EXPECT_TRUE(success); 359 EXPECT_TRUE(success);
375 EXPECT_FALSE(cache_entry.is_dirty()); 360 EXPECT_FALSE(cache_entry.is_dirty());
376 } 361 }
377 362
378 } // namespace internal 363 } // namespace internal
379 } // namespace drive 364 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698