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

Side by Side Diff: components/drive/resource_entry_conversion_unittest.cc

Issue 2799603002: Process TeamDrive change in change list. (Closed)
Patch Set: Avoid crash when receiving TD deletion entry. Created 3 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
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 "components/drive/resource_entry_conversion.h" 5 #include "components/drive/resource_entry_conversion.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "components/drive/drive.pb.h" 9 #include "components/drive/drive.pb.h"
10 #include "components/drive/drive_api_util.h" 10 #include "components/drive/drive_api_util.h"
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 ResourceEntry entry; 386 ResourceEntry entry;
387 std::string parent_resource_id; 387 std::string parent_resource_id;
388 EXPECT_TRUE(ConvertFileResourceToResourceEntry( 388 EXPECT_TRUE(ConvertFileResourceToResourceEntry(
389 entry_no_fields, &entry, &parent_resource_id)); 389 entry_no_fields, &entry, &parent_resource_id));
390 EXPECT_FALSE(entry.file_specific_info().has_image_width()); 390 EXPECT_FALSE(entry.file_specific_info().has_image_width());
391 EXPECT_FALSE(entry.file_specific_info().has_image_height()); 391 EXPECT_FALSE(entry.file_specific_info().has_image_height());
392 EXPECT_FALSE(entry.file_specific_info().has_image_rotation()); 392 EXPECT_FALSE(entry.file_specific_info().has_image_rotation());
393 } 393 }
394 } 394 }
395 395
396 TEST(ResourceEntryConversionTest,
397 ConvertTeamDriveChangeResourceToResourceEntry) {
398 google_apis::ChangeResource change_resource;
399 change_resource.set_type(google_apis::ChangeResource::TEAM_DRIVE);
400 change_resource.set_team_drive(
401 base::WrapUnique(new google_apis::TeamDriveResource));
402 change_resource.set_team_drive_id("team_drive_id");
403 change_resource.set_modification_date(GetTestTime());
404 change_resource.set_deleted(false);
405
406 google_apis::TeamDriveResource* team_drive_resource =
407 change_resource.mutable_team_drive();
408 team_drive_resource->set_name("ABC Team Drive");
409 team_drive_resource->set_id("team_drive_id");
410
411 ResourceEntry team_drive_change;
412 EXPECT_TRUE(ConvertTeamDriveChangeResourceToResourceEntry(
413 change_resource, &team_drive_change));
414
415 EXPECT_EQ(change_resource.team_drive_id(), team_drive_change.resource_id());
416 EXPECT_EQ(team_drive_resource->name(), team_drive_change.title());
417 EXPECT_EQ(change_resource.modification_date().ToInternalValue(),
418 team_drive_change.modification_date());
419 EXPECT_FALSE(team_drive_change.deleted());
420 }
421
396 } // namespace drive 422 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698