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

Side by Side Diff: google_apis/drive/gdata_wapi_parser_unittest.cc

Issue 384543004: Get rid of DriveEntryKind. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 "google_apis/drive/gdata_wapi_parser.h" 5 #include "google_apis/drive/gdata_wapi_parser.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/json/json_file_value_serializer.h" 10 #include "base/json/json_file_value_serializer.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 EXPECT_EQ("3b4382ebefec6e743578c76bbd0575ce", entry->file_md5()); 228 EXPECT_EQ("3b4382ebefec6e743578c76bbd0575ce", entry->file_md5());
229 EXPECT_EQ(892721, entry->file_size()); 229 EXPECT_EQ(892721, entry->file_size());
230 230
231 // WAPI doesn't provide image metadata, but these fields are available 231 // WAPI doesn't provide image metadata, but these fields are available
232 // since this class can wrap data received from Drive API (via a converter). 232 // since this class can wrap data received from Drive API (via a converter).
233 EXPECT_EQ(-1, entry->image_width()); 233 EXPECT_EQ(-1, entry->image_width());
234 EXPECT_EQ(-1, entry->image_height()); 234 EXPECT_EQ(-1, entry->image_height());
235 EXPECT_EQ(-1, entry->image_rotation()); 235 EXPECT_EQ(-1, entry->image_rotation());
236 } 236 }
237 237
238 TEST(GDataWAPIParserTest, ClassifyEntryKindByFileExtension) {
239 EXPECT_EQ(
240 ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
241 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
242 ResourceEntry::ClassifyEntryKindByFileExtension(
243 base::FilePath(FILE_PATH_LITERAL("Test.gdoc"))));
244 EXPECT_EQ(
245 ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
246 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
247 ResourceEntry::ClassifyEntryKindByFileExtension(
248 base::FilePath(FILE_PATH_LITERAL("Test.gsheet"))));
249 EXPECT_EQ(
250 ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
251 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
252 ResourceEntry::ClassifyEntryKindByFileExtension(
253 base::FilePath(FILE_PATH_LITERAL("Test.gslides"))));
254 EXPECT_EQ(
255 ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
256 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
257 ResourceEntry::ClassifyEntryKindByFileExtension(
258 base::FilePath(FILE_PATH_LITERAL("Test.gdraw"))));
259 EXPECT_EQ(
260 ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
261 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
262 ResourceEntry::ClassifyEntryKindByFileExtension(
263 base::FilePath(FILE_PATH_LITERAL("Test.gtable"))));
264 EXPECT_EQ(
265 ResourceEntry::KIND_OF_EXTERNAL_DOCUMENT |
266 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
267 ResourceEntry::ClassifyEntryKindByFileExtension(
268 base::FilePath(FILE_PATH_LITERAL("Test.glink"))));
269 EXPECT_EQ(
270 ResourceEntry::KIND_OF_NONE,
271 ResourceEntry::ClassifyEntryKindByFileExtension(
272 base::FilePath(FILE_PATH_LITERAL("Test.tar.gz"))));
273 EXPECT_EQ(
274 ResourceEntry::KIND_OF_NONE,
275 ResourceEntry::ClassifyEntryKindByFileExtension(
276 base::FilePath(FILE_PATH_LITERAL("Test.txt"))));
277 EXPECT_EQ(
278 ResourceEntry::KIND_OF_NONE,
279 ResourceEntry::ClassifyEntryKindByFileExtension(
280 base::FilePath(FILE_PATH_LITERAL("Test"))));
281 EXPECT_EQ(
282 ResourceEntry::KIND_OF_NONE,
283 ResourceEntry::ClassifyEntryKindByFileExtension(
284 base::FilePath()));
285 }
286
287 TEST(GDataWAPIParserTest, ResourceEntryClassifyEntryKind) {
288 EXPECT_EQ(ResourceEntry::KIND_OF_NONE,
289 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_UNKNOWN));
290 EXPECT_EQ(ResourceEntry::KIND_OF_NONE,
291 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_ITEM));
292 EXPECT_EQ(ResourceEntry::KIND_OF_NONE,
293 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_SITE));
294 EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
295 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
296 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_DOCUMENT));
297 EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
298 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
299 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_SPREADSHEET));
300 EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
301 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
302 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_PRESENTATION));
303 EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
304 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
305 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_DRAWING));
306 EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
307 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
308 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_TABLE));
309 EXPECT_EQ(ResourceEntry::KIND_OF_EXTERNAL_DOCUMENT |
310 ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
311 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_EXTERNAL_APP));
312 EXPECT_EQ(ResourceEntry::KIND_OF_FOLDER,
313 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_FOLDER));
314 EXPECT_EQ(ResourceEntry::KIND_OF_FILE,
315 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_FILE));
316 EXPECT_EQ(ResourceEntry::KIND_OF_FILE,
317 ResourceEntry::ClassifyEntryKind(ENTRY_KIND_PDF));
318 }
319
320 } // namespace google_apis 238 } // namespace google_apis
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698