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

Unified Diff: chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc

Issue 11360027: drive: prefetcher compares last modified time in addition to last access time. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/drive/drive_prefetcher.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc
diff --git a/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc b/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc
index 4e55fca62cad1e61a6290d74e08bafbdd5d59ef0..b44ebbd4dd2b790960bed7f80f57c0327b46a713 100644
--- a/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_prefetcher_unittest.cc
@@ -35,7 +35,8 @@ enum TestEntryType {
struct TestEntry {
const FilePath::CharType* path;
TestEntryType entry_type;
- int64 last_access;
+ int64 last_accessed;
+ int64 last_modified;
const char* resource_id;
int64 file_size;
@@ -55,7 +56,8 @@ struct TestEntry {
entry_type == TYPE_HOSTED_FILE);
entry.mutable_file_info()->set_size(file_size);
}
- entry.mutable_file_info()->set_last_accessed(last_access);
+ entry.mutable_file_info()->set_last_accessed(last_accessed);
+ entry.mutable_file_info()->set_last_modified(last_modified);
entry.set_resource_id(resource_id);
return entry;
}
@@ -84,37 +86,39 @@ ACTION_P(MockReadDirectory, test_entries) {
}
const TestEntry kEmptyDrive[] = {
- { FILE_PATH_LITERAL("drive"), TYPE_DIRECTORY, 0, "id:drive" },
+ { FILE_PATH_LITERAL("drive"), TYPE_DIRECTORY, 0, 0, "id:drive" },
};
const TestEntry kOneFileDrive[] = {
- { FILE_PATH_LITERAL("drive"), TYPE_DIRECTORY, 0, "id:drive" },
- { FILE_PATH_LITERAL("drive/abc.txt"), TYPE_REGULAR_FILE, 1, "id:abc" },
+ { FILE_PATH_LITERAL("drive"), TYPE_DIRECTORY, 0, 0, "id:drive" },
+ { FILE_PATH_LITERAL("drive/abc.txt"), TYPE_REGULAR_FILE, 1, 0, "id:abc" },
};
const char* kExpectedOneFile[] = { "id:abc" };
const TestEntry kComplexDrive[] = {
- { FILE_PATH_LITERAL("drive"), TYPE_DIRECTORY, 0, "id:root" },
- { FILE_PATH_LITERAL("drive/a"), TYPE_DIRECTORY, 0, "id:a" },
- { FILE_PATH_LITERAL("drive/a/foo.txt"), TYPE_REGULAR_FILE, 3, "id:foo1" },
- { FILE_PATH_LITERAL("drive/a/b"), TYPE_DIRECTORY, 8, "id:b" },
- { FILE_PATH_LITERAL("drive/a/b/bar.jpg"), TYPE_REGULAR_FILE, 5, "id:bar1",
- 999 },
- { FILE_PATH_LITERAL("drive/a/b/new.gdoc"), TYPE_HOSTED_FILE, 7, "id:new" },
- { FILE_PATH_LITERAL("drive/a/buz.zip"), TYPE_REGULAR_FILE, 4, "id:buz1" },
- { FILE_PATH_LITERAL("drive/a/old.gdoc"), TYPE_HOSTED_FILE, 1, "id:old" },
- { FILE_PATH_LITERAL("drive/c"), TYPE_DIRECTORY, 0, "id:c" },
- { FILE_PATH_LITERAL("drive/c/foo.txt"), TYPE_REGULAR_FILE, 2, "id:foo2" },
- { FILE_PATH_LITERAL("drive/c/buz.zip"), TYPE_REGULAR_FILE, 1, "id:buz2" },
- { FILE_PATH_LITERAL("drive/bar.jpg"), TYPE_REGULAR_FILE, 6, "id:bar2" },
+ // Path Type Access Modify ID
+ { FILE_PATH_LITERAL("drive"), TYPE_DIRECTORY, 0, 0, "id:root" },
+ { FILE_PATH_LITERAL("drive/a"), TYPE_DIRECTORY, 0, 0, "id:a" },
+ { FILE_PATH_LITERAL("drive/a/foo.txt"), TYPE_REGULAR_FILE, 3, 2, "id:foo1" },
+ { FILE_PATH_LITERAL("drive/a/b"), TYPE_DIRECTORY, 8, 0, "id:b" },
+ { FILE_PATH_LITERAL("drive/a/bar.jpg"), TYPE_REGULAR_FILE, 5, 0, "id:bar1",
+ 999 },
+ { FILE_PATH_LITERAL("drive/a/b/x.gdoc"), TYPE_HOSTED_FILE, 7, 0, "id:new" },
+ { FILE_PATH_LITERAL("drive/a/buz.zip"), TYPE_REGULAR_FILE, 4, 0, "id:buz1" },
+ { FILE_PATH_LITERAL("drive/a/old.gdoc"), TYPE_HOSTED_FILE, 1, 0, "id:old" },
+ { FILE_PATH_LITERAL("drive/c"), TYPE_DIRECTORY, 0, 0, "id:c" },
+ { FILE_PATH_LITERAL("drive/c/foo.txt"), TYPE_REGULAR_FILE, 3, 1, "id:foo2" },
+ { FILE_PATH_LITERAL("drive/c/buz.zip"), TYPE_REGULAR_FILE, 1, 0, "id:buz2" },
+ { FILE_PATH_LITERAL("drive/bar.jpg"), TYPE_REGULAR_FILE, 6, 0, "id:bar2" },
};
const char* kTop3Files[] = {
"id:bar2", // The file with the largest timestamp
// "bar1" is the second latest, but its file size is over limit.
"id:buz1", // The third latest file.
- "id:foo1" // 4th.
+ "id:foo1" // 4th. Has same access time with id:foo2, so the one with the
+ // newer modified time wins.
};
const char* kAllRegularFiles[] = {
« no previous file with comments | « chrome/browser/chromeos/drive/drive_prefetcher.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698