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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_parser_unittest.cc

Issue 10669038: base: Remove dereference structure operator (i.e ->) from ScopedVector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/json/json_file_value_serializer.h" 7 #include "base/json/json_file_value_serializer.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/string16.h" 9 #include "base/string16.h"
10 #include "base/time.h" 10 #include "base/time.h"
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 ASSERT_TRUE(reinterpret_cast<DictionaryValue*>(document.get())->GetDictionary( 316 ASSERT_TRUE(reinterpret_cast<DictionaryValue*>(document.get())->GetDictionary(
317 std::string("entry"), &entry_value)); 317 std::string("entry"), &entry_value));
318 ASSERT_TRUE(entry_value); 318 ASSERT_TRUE(entry_value);
319 319
320 scoped_ptr<AccountMetadataFeed> feed( 320 scoped_ptr<AccountMetadataFeed> feed(
321 AccountMetadataFeed::CreateFrom(*document)); 321 AccountMetadataFeed::CreateFrom(*document));
322 ASSERT_TRUE(feed.get()); 322 ASSERT_TRUE(feed.get());
323 EXPECT_EQ(GG_LONGLONG(6789012345), feed->quota_bytes_used()); 323 EXPECT_EQ(GG_LONGLONG(6789012345), feed->quota_bytes_used());
324 EXPECT_EQ(GG_LONGLONG(9876543210), feed->quota_bytes_total()); 324 EXPECT_EQ(GG_LONGLONG(9876543210), feed->quota_bytes_total());
325 EXPECT_EQ(654321, feed->largest_changestamp()); 325 EXPECT_EQ(654321, feed->largest_changestamp());
326 EXPECT_EQ(2U, feed->installed_apps()->size()); 326 EXPECT_EQ(2U, feed->installed_apps().size());
327 const InstalledApp* first_app = feed->installed_apps()[0]; 327 const InstalledApp* first_app = feed->installed_apps()[0];
328 const InstalledApp* second_app = feed->installed_apps()[1]; 328 const InstalledApp* second_app = feed->installed_apps()[1];
329 329
330 IF_EXPECT_TRUE(first_app) { 330 IF_EXPECT_TRUE(first_app) {
331 EXPECT_EQ("Drive App 1", UTF16ToUTF8(first_app->app_name())); 331 EXPECT_EQ("Drive App 1", UTF16ToUTF8(first_app->app_name()));
332 EXPECT_EQ("Drive App Object 1", UTF16ToUTF8(first_app->object_type())); 332 EXPECT_EQ("Drive App Object 1", UTF16ToUTF8(first_app->object_type()));
333 EXPECT_TRUE(first_app->supports_create()); 333 EXPECT_TRUE(first_app->supports_create());
334 EXPECT_EQ("https://chrome.google.com/webstore/detail/abcdefabcdef", 334 EXPECT_EQ("https://chrome.google.com/webstore/detail/abcdefabcdef",
335 first_app->GetProductUrl().spec()); 335 first_app->GetProductUrl().spec());
336 IF_EXPECT_EQ(2U, first_app->primary_mimetypes()->size()) { 336 IF_EXPECT_EQ(2U, first_app->primary_mimetypes().size()) {
337 EXPECT_EQ("application/test_type_1", 337 EXPECT_EQ("application/test_type_1",
338 *first_app->primary_mimetypes()->at(0)); 338 *first_app->primary_mimetypes()[0]);
339 EXPECT_EQ("application/vnd.google-apps.drive-sdk.11111111", 339 EXPECT_EQ("application/vnd.google-apps.drive-sdk.11111111",
340 *first_app->primary_mimetypes()->at(1)); 340 *first_app->primary_mimetypes()[1]);
341 } 341 }
342 IF_EXPECT_EQ(1U, first_app->secondary_mimetypes()->size()) { 342 IF_EXPECT_EQ(1U, first_app->secondary_mimetypes().size()) {
343 EXPECT_EQ("image/jpeg", *first_app->secondary_mimetypes()->at(0)); 343 EXPECT_EQ("image/jpeg", *first_app->secondary_mimetypes()[0]);
344 } 344 }
345 IF_EXPECT_EQ(2U, first_app->primary_extensions()->size()) { 345 IF_EXPECT_EQ(2U, first_app->primary_extensions().size()) {
346 EXPECT_EQ("ext_1", *first_app->primary_extensions()->at(0)); 346 EXPECT_EQ("ext_1", *first_app->primary_extensions()[0]);
347 EXPECT_EQ("ext_2", *first_app->primary_extensions()->at(1)); 347 EXPECT_EQ("ext_2", *first_app->primary_extensions()[1]);
348 } 348 }
349 IF_EXPECT_EQ(1U, first_app->secondary_extensions()->size()) { 349 IF_EXPECT_EQ(1U, first_app->secondary_extensions().size()) {
350 EXPECT_EQ("ext_3", *first_app->secondary_extensions()->at(0)); 350 EXPECT_EQ("ext_3", *first_app->secondary_extensions()[0]);
351 } 351 }
352 IF_EXPECT_EQ(1U, first_app->app_icons()->size()) { 352 IF_EXPECT_EQ(1U, first_app->app_icons().size()) {
353 EXPECT_EQ(AppIcon::DOCUMENT, first_app->app_icons()->at(0)->category()); 353 EXPECT_EQ(AppIcon::DOCUMENT, first_app->app_icons()[0]->category());
354 EXPECT_EQ(16, first_app->app_icons()->at(0)->icon_side_length()); 354 EXPECT_EQ(16, first_app->app_icons()[0]->icon_side_length());
355 GURL icon_url = first_app->app_icons()->at(0)->GetIconURL(); 355 GURL icon_url = first_app->app_icons()[0]->GetIconURL();
356 EXPECT_EQ("https://www.google.com/images/srpr/logo3w.png", 356 EXPECT_EQ("https://www.google.com/images/srpr/logo3w.png",
357 icon_url.spec()); 357 icon_url.spec());
358 InstalledApp::IconList icons = 358 InstalledApp::IconList icons =
359 first_app->GetIconsForCategory(AppIcon::DOCUMENT); 359 first_app->GetIconsForCategory(AppIcon::DOCUMENT);
360 EXPECT_EQ("https://www.google.com/images/srpr/logo3w.png", 360 EXPECT_EQ("https://www.google.com/images/srpr/logo3w.png",
361 icons[0].second.spec()); 361 icons[0].second.spec());
362 icons = first_app->GetIconsForCategory(AppIcon::SHARED_DOCUMENT); 362 icons = first_app->GetIconsForCategory(AppIcon::SHARED_DOCUMENT);
363 EXPECT_TRUE(icons.empty()); 363 EXPECT_TRUE(icons.empty());
364 } 364 }
365 } 365 }
366 366
367 IF_EXPECT_TRUE(second_app) { 367 IF_EXPECT_TRUE(second_app) {
368 EXPECT_EQ("Drive App 2", UTF16ToUTF8(second_app->app_name())); 368 EXPECT_EQ("Drive App 2", UTF16ToUTF8(second_app->app_name()));
369 EXPECT_EQ("Drive App Object 2", UTF16ToUTF8(second_app->object_type())); 369 EXPECT_EQ("Drive App Object 2", UTF16ToUTF8(second_app->object_type()));
370 EXPECT_EQ("https://chrome.google.com/webstore/detail/deadbeefdeadbeef", 370 EXPECT_EQ("https://chrome.google.com/webstore/detail/deadbeefdeadbeef",
371 second_app->GetProductUrl().spec()); 371 second_app->GetProductUrl().spec());
372 EXPECT_FALSE(second_app->supports_create()); 372 EXPECT_FALSE(second_app->supports_create());
373 EXPECT_EQ(2U, second_app->primary_mimetypes()->size()); 373 EXPECT_EQ(2U, second_app->primary_mimetypes().size());
374 EXPECT_EQ(0U, second_app->secondary_mimetypes()->size()); 374 EXPECT_EQ(0U, second_app->secondary_mimetypes().size());
375 EXPECT_EQ(1U, second_app->primary_extensions()->size()); 375 EXPECT_EQ(1U, second_app->primary_extensions().size());
376 EXPECT_EQ(0U, second_app->secondary_extensions()->size()); 376 EXPECT_EQ(0U, second_app->secondary_extensions().size());
377 } 377 }
378 } 378 }
379 379
380 // Test file extension checking in DocumentEntry::HasDocumentExtension(). 380 // Test file extension checking in DocumentEntry::HasDocumentExtension().
381 TEST_F(GDataParserTest, DocumentEntryHasDocumentExtension) { 381 TEST_F(GDataParserTest, DocumentEntryHasDocumentExtension) {
382 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 382 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
383 FilePath(FILE_PATH_LITERAL("Test.gdoc")))); 383 FilePath(FILE_PATH_LITERAL("Test.gdoc"))));
384 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 384 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
385 FilePath(FILE_PATH_LITERAL("Test.gsheet")))); 385 FilePath(FILE_PATH_LITERAL("Test.gsheet"))));
386 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 386 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
387 FilePath(FILE_PATH_LITERAL("Test.gslides")))); 387 FilePath(FILE_PATH_LITERAL("Test.gslides"))));
388 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 388 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
389 FilePath(FILE_PATH_LITERAL("Test.gdraw")))); 389 FilePath(FILE_PATH_LITERAL("Test.gdraw"))));
390 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 390 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
391 FilePath(FILE_PATH_LITERAL("Test.gtable")))); 391 FilePath(FILE_PATH_LITERAL("Test.gtable"))));
392 EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension( 392 EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension(
393 FilePath(FILE_PATH_LITERAL("Test.tar.gz")))); 393 FilePath(FILE_PATH_LITERAL("Test.tar.gz"))));
394 EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension( 394 EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension(
395 FilePath(FILE_PATH_LITERAL("Test.txt")))); 395 FilePath(FILE_PATH_LITERAL("Test.txt"))));
396 EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension( 396 EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension(
397 FilePath(FILE_PATH_LITERAL("Test")))); 397 FilePath(FILE_PATH_LITERAL("Test"))));
398 EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension( 398 EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension(
399 FilePath(FILE_PATH_LITERAL("")))); 399 FilePath(FILE_PATH_LITERAL(""))));
400 } 400 }
401 401
402 } // namespace gdata 402 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_parser.cc ('k') | chrome/browser/history/history_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698