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

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

Issue 13149003: drive: Use "/drive/root" namespace and fix Files app and tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 8 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/drive_prefetcher.h" 5 #include "chrome/browser/chromeos/drive/drive_prefetcher.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 81
82 scoped_ptr<DriveEntryProtoVector> entries(new DriveEntryProtoVector); 82 scoped_ptr<DriveEntryProtoVector> entries(new DriveEntryProtoVector);
83 for (size_t i = 0; i < test_entries.size(); ++i) { 83 for (size_t i = 0; i < test_entries.size(); ++i) {
84 if (test_entries[i].IsDirectChildOf(directory)) 84 if (test_entries[i].IsDirectChildOf(directory))
85 entries->push_back(test_entries[i].ToDriveEntryProto()); 85 entries->push_back(test_entries[i].ToDriveEntryProto());
86 } 86 }
87 callback.Run(DRIVE_FILE_OK, false /* hide_hosted_document */, entries.Pass()); 87 callback.Run(DRIVE_FILE_OK, false /* hide_hosted_document */, entries.Pass());
88 } 88 }
89 89
90 const TestEntry kEmptyDrive[] = { 90 const TestEntry kEmptyDrive[] = {
91 { FILE_PATH_LITERAL("drive"), TYPE_DIRECTORY, 0, 0, "id:drive" }, 91 { FILE_PATH_LITERAL("drive/root"), TYPE_DIRECTORY, 0, 0, "id:drive" },
92 }; 92 };
93 93
94 const TestEntry kOneFileDrive[] = { 94 const TestEntry kOneFileDrive[] = {
95 { FILE_PATH_LITERAL("drive"), TYPE_DIRECTORY, 0, 0, "id:drive" }, 95 { FILE_PATH_LITERAL("drive/root"), TYPE_DIRECTORY, 0, 0, "id:drive" },
96 { FILE_PATH_LITERAL("drive/abc.txt"), TYPE_REGULAR_FILE, 1, 0, "id:abc" }, 96 { FILE_PATH_LITERAL("drive/root/abc.txt"), TYPE_REGULAR_FILE, 1, 0,
97 "id:abc" },
97 }; 98 };
98 99
99 const char* kExpectedOneFile[] = { "id:abc" }; 100 const char* kExpectedOneFile[] = { "id:abc" };
100 101
101 const TestEntry kComplexDrive[] = { 102 const TestEntry kComplexDrive[] = {
satorux1 2013/04/05 01:55:30 The table became a bit harder to read. Can you do:
Haruki Sato 2013/04/05 04:35:25 Done.
102 // Path Type Access Modify ID 103 // Path Type Access Modify
103 { FILE_PATH_LITERAL("drive"), TYPE_DIRECTORY, 0, 0, "id:root" }, 104 // ID
104 { FILE_PATH_LITERAL("drive/a"), TYPE_DIRECTORY, 0, 0, "id:a" }, 105 { FILE_PATH_LITERAL("drive/root"), TYPE_DIRECTORY, 0, 0,
105 { FILE_PATH_LITERAL("drive/a/foo.txt"), TYPE_REGULAR_FILE, 3, 2, "id:foo1" }, 106 "id:root" },
106 { FILE_PATH_LITERAL("drive/a/b"), TYPE_DIRECTORY, 8, 0, "id:b" }, 107 { FILE_PATH_LITERAL("drive/root/a"), TYPE_DIRECTORY, 0, 0,
107 { FILE_PATH_LITERAL("drive/a/bar.jpg"), TYPE_REGULAR_FILE, 5, 0, "id:bar1", 108 "id:a" },
109 { FILE_PATH_LITERAL("drive/root/a/foo.txt"), TYPE_REGULAR_FILE, 3, 2,
110 "id:foo1" },
111 { FILE_PATH_LITERAL("drive/root/a/b"), TYPE_DIRECTORY, 8, 0,
112 "id:b" },
113 { FILE_PATH_LITERAL("drive/root/a/bar.jpg"), TYPE_REGULAR_FILE, 5, 0,
114 "id:bar1",
108 999 }, 115 999 },
109 { FILE_PATH_LITERAL("drive/a/b/x.gdoc"), TYPE_HOSTED_FILE, 7, 0, "id:new" }, 116 { FILE_PATH_LITERAL("drive/root/a/b/x.gdoc"), TYPE_HOSTED_FILE, 7, 0,
110 { FILE_PATH_LITERAL("drive/a/buz.zip"), TYPE_REGULAR_FILE, 4, 0, "id:buz1" }, 117 "id:new" },
111 { FILE_PATH_LITERAL("drive/a/old.gdoc"), TYPE_HOSTED_FILE, 1, 0, "id:old" }, 118 { FILE_PATH_LITERAL("drive/root/a/buz.zip"), TYPE_REGULAR_FILE, 4, 0,
112 { FILE_PATH_LITERAL("drive/c"), TYPE_DIRECTORY, 0, 0, "id:c" }, 119 "id:buz1" },
113 { FILE_PATH_LITERAL("drive/c/foo.txt"), TYPE_REGULAR_FILE, 3, 1, "id:foo2" }, 120 { FILE_PATH_LITERAL("drive/root/a/old.gdoc"), TYPE_HOSTED_FILE, 1, 0,
114 { FILE_PATH_LITERAL("drive/c/buz.zip"), TYPE_REGULAR_FILE, 1, 0, "id:buz2" }, 121 "id:old" },
115 { FILE_PATH_LITERAL("drive/bar.jpg"), TYPE_REGULAR_FILE, 6, 0, "id:bar2" }, 122 { FILE_PATH_LITERAL("drive/root/c"), TYPE_DIRECTORY, 0, 0,
123 "id:c" },
124 { FILE_PATH_LITERAL("drive/root/c/foo.txt"), TYPE_REGULAR_FILE, 3, 1,
125 "id:foo2" },
126 { FILE_PATH_LITERAL("drive/root/c/buz.zip"), TYPE_REGULAR_FILE, 1, 0,
127 "id:buz2" },
128 { FILE_PATH_LITERAL("drive/root/bar.jpg"), TYPE_REGULAR_FILE, 6, 0,
129 "id:bar2" },
116 }; 130 };
117 131
118 const char* kTop3Files[] = { 132 const char* kTop3Files[] = {
119 "id:bar2", // The file with the largest timestamp 133 "id:bar2", // The file with the largest timestamp
120 // "bar1" is the second latest, but its file size is over limit. 134 // "bar1" is the second latest, but its file size is over limit.
121 "id:buz1", // The third latest file. 135 "id:buz1", // The third latest file.
122 "id:foo1" // 4th. Has same access time with id:foo2, so the one with the 136 "id:foo1" // 4th. Has same access time with id:foo2, so the one with the
123 // newer modified time wins. 137 // newer modified time wins.
124 }; 138 };
125 139
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 // This is checked by setting the fetch limit larger than the number of files. 232 // This is checked by setting the fetch limit larger than the number of files.
219 InitPrefetcher(100, 99999999); 233 InitPrefetcher(100, 99999999);
220 VerifyFullScan( 234 VerifyFullScan(
221 std::vector<TestEntry>(kComplexDrive, 235 std::vector<TestEntry>(kComplexDrive,
222 kComplexDrive + arraysize(kComplexDrive)), 236 kComplexDrive + arraysize(kComplexDrive)),
223 std::vector<std::string>(kAllRegularFiles, 237 std::vector<std::string>(kAllRegularFiles,
224 kAllRegularFiles + arraysize(kAllRegularFiles))); 238 kAllRegularFiles + arraysize(kAllRegularFiles)));
225 } 239 }
226 240
227 } // namespace drive 241 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698