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

Side by Side Diff: chrome/browser/drive/fake_drive_service_unittest.cc

Issue 137343008: Make chrome.fileSystem.chooseEntry work on Google Drive directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test. Created 6 years, 11 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/drive/fake_drive_service.h" 5 #include "chrome/browser/drive/fake_drive_service.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after
1111 kResourceId, 1111 kResourceId,
1112 kParentResourceId, 1112 kParentResourceId,
1113 "new title", 1113 "new title",
1114 base::Time::FromUTCExploded(kModifiedDate), 1114 base::Time::FromUTCExploded(kModifiedDate),
1115 test_util::CreateCopyResultCallback(&error, &resource_entry)); 1115 test_util::CreateCopyResultCallback(&error, &resource_entry));
1116 base::RunLoop().RunUntilIdle(); 1116 base::RunLoop().RunUntilIdle();
1117 1117
1118 EXPECT_EQ(HTTP_SUCCESS, error); 1118 EXPECT_EQ(HTTP_SUCCESS, error);
1119 ASSERT_TRUE(resource_entry); 1119 ASSERT_TRUE(resource_entry);
1120 // The copied entry should have the new resource ID and the title. 1120 // The copied entry should have the new resource ID and the title.
1121 EXPECT_EQ(kResourceId + "_copied", resource_entry->resource_id()); 1121 EXPECT_NE(kResourceId, resource_entry->resource_id());
1122 EXPECT_EQ("new title", resource_entry->title()); 1122 EXPECT_EQ("new title", resource_entry->title());
1123 EXPECT_EQ(base::Time::FromUTCExploded(kModifiedDate), 1123 EXPECT_EQ(base::Time::FromUTCExploded(kModifiedDate),
1124 resource_entry->updated_time()); 1124 resource_entry->updated_time());
1125 EXPECT_TRUE(HasParent(resource_entry->resource_id(), kParentResourceId)); 1125 EXPECT_TRUE(HasParent(resource_entry->resource_id(), kParentResourceId));
1126 // Should be incremented as a new hosted document was created. 1126 // Should be incremented as a new hosted document was created.
1127 EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp()); 1127 EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp());
1128 EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource()); 1128 EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource());
1129 } 1129 }
1130 1130
1131 TEST_F(FakeDriveServiceTest, CopyResource_NonExisting) { 1131 TEST_F(FakeDriveServiceTest, CopyResource_NonExisting) {
(...skipping 29 matching lines...) Expand all
1161 kResourceId, 1161 kResourceId,
1162 std::string(), 1162 std::string(),
1163 "new title", 1163 "new title",
1164 base::Time(), 1164 base::Time(),
1165 test_util::CreateCopyResultCallback(&error, &resource_entry)); 1165 test_util::CreateCopyResultCallback(&error, &resource_entry));
1166 base::RunLoop().RunUntilIdle(); 1166 base::RunLoop().RunUntilIdle();
1167 1167
1168 EXPECT_EQ(HTTP_SUCCESS, error); 1168 EXPECT_EQ(HTTP_SUCCESS, error);
1169 ASSERT_TRUE(resource_entry); 1169 ASSERT_TRUE(resource_entry);
1170 // The copied entry should have the new resource ID and the title. 1170 // The copied entry should have the new resource ID and the title.
1171 EXPECT_EQ(kResourceId + "_copied", resource_entry->resource_id()); 1171 EXPECT_NE(kResourceId, resource_entry->resource_id());
1172 EXPECT_EQ("new title", resource_entry->title()); 1172 EXPECT_EQ("new title", resource_entry->title());
1173 EXPECT_TRUE(HasParent(kResourceId, fake_service_.GetRootResourceId())); 1173 EXPECT_TRUE(HasParent(kResourceId, fake_service_.GetRootResourceId()));
1174 // Should be incremented as a new hosted document was created. 1174 // Should be incremented as a new hosted document was created.
1175 EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp()); 1175 EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp());
1176 EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource()); 1176 EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource());
1177 } 1177 }
1178 1178
1179 TEST_F(FakeDriveServiceTest, CopyResource_Offline) { 1179 TEST_F(FakeDriveServiceTest, CopyResource_Offline) {
1180 ASSERT_TRUE(fake_service_.LoadResourceListForWapi( 1180 ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
1181 "gdata/root_feed.json")); 1181 "gdata/root_feed.json"));
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1215 kResourceId, 1215 kResourceId,
1216 kParentResourceId, 1216 kParentResourceId,
1217 "new title", 1217 "new title",
1218 base::Time::FromUTCExploded(kModifiedDate), 1218 base::Time::FromUTCExploded(kModifiedDate),
1219 base::Time::FromUTCExploded(kViewedDate), 1219 base::Time::FromUTCExploded(kViewedDate),
1220 test_util::CreateCopyResultCallback(&error, &resource_entry)); 1220 test_util::CreateCopyResultCallback(&error, &resource_entry));
1221 base::RunLoop().RunUntilIdle(); 1221 base::RunLoop().RunUntilIdle();
1222 1222
1223 EXPECT_EQ(HTTP_SUCCESS, error); 1223 EXPECT_EQ(HTTP_SUCCESS, error);
1224 ASSERT_TRUE(resource_entry); 1224 ASSERT_TRUE(resource_entry);
1225 // The copied entry should have the new resource ID and the title. 1225 // The updated entry should have the new title.
1226 EXPECT_EQ(kResourceId, resource_entry->resource_id()); 1226 EXPECT_EQ(kResourceId, resource_entry->resource_id());
1227 EXPECT_EQ("new title", resource_entry->title()); 1227 EXPECT_EQ("new title", resource_entry->title());
1228 EXPECT_EQ(base::Time::FromUTCExploded(kModifiedDate), 1228 EXPECT_EQ(base::Time::FromUTCExploded(kModifiedDate),
1229 resource_entry->updated_time()); 1229 resource_entry->updated_time());
1230 EXPECT_EQ(base::Time::FromUTCExploded(kViewedDate), 1230 EXPECT_EQ(base::Time::FromUTCExploded(kViewedDate),
1231 resource_entry->last_viewed_time()); 1231 resource_entry->last_viewed_time());
1232 EXPECT_TRUE(HasParent(kResourceId, kParentResourceId)); 1232 EXPECT_TRUE(HasParent(kResourceId, kParentResourceId));
1233 // Should be incremented as a new hosted document was created. 1233 // Should be incremented as a new hosted document was created.
1234 EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp()); 1234 EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp());
1235 EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource()); 1235 EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource());
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 kResourceId, 1273 kResourceId,
1274 std::string(), 1274 std::string(),
1275 "new title", 1275 "new title",
1276 base::Time(), 1276 base::Time(),
1277 base::Time(), 1277 base::Time(),
1278 test_util::CreateCopyResultCallback(&error, &resource_entry)); 1278 test_util::CreateCopyResultCallback(&error, &resource_entry));
1279 base::RunLoop().RunUntilIdle(); 1279 base::RunLoop().RunUntilIdle();
1280 1280
1281 EXPECT_EQ(HTTP_SUCCESS, error); 1281 EXPECT_EQ(HTTP_SUCCESS, error);
1282 ASSERT_TRUE(resource_entry); 1282 ASSERT_TRUE(resource_entry);
1283 // The copied entry should have the new resource ID and the title. 1283 // The updated entry should have the new title.
1284 EXPECT_EQ(kResourceId, resource_entry->resource_id()); 1284 EXPECT_EQ(kResourceId, resource_entry->resource_id());
1285 EXPECT_EQ("new title", resource_entry->title()); 1285 EXPECT_EQ("new title", resource_entry->title());
1286 EXPECT_TRUE(HasParent(kResourceId, "fake_root")); 1286 EXPECT_TRUE(HasParent(kResourceId, "fake_root"));
1287 // Should be incremented as a new hosted document was created. 1287 // Should be incremented as a new hosted document was created.
1288 EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp()); 1288 EXPECT_EQ(old_largest_change_id + 1, fake_service_.largest_changestamp());
1289 EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource()); 1289 EXPECT_EQ(old_largest_change_id + 1, GetLargestChangeByAboutResource());
1290 } 1290 }
1291 1291
1292 TEST_F(FakeDriveServiceTest, UpdateResource_Offline) { 1292 TEST_F(FakeDriveServiceTest, UpdateResource_Offline) {
1293 ASSERT_TRUE(fake_service_.LoadResourceListForWapi( 1293 ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
2330 test_util::CreateCopyResultCallback(&error, &resource_entry)); 2330 test_util::CreateCopyResultCallback(&error, &resource_entry));
2331 base::RunLoop().RunUntilIdle(); 2331 base::RunLoop().RunUntilIdle();
2332 2332
2333 EXPECT_EQ(GDATA_NO_CONNECTION, error); 2333 EXPECT_EQ(GDATA_NO_CONNECTION, error);
2334 EXPECT_FALSE(resource_entry); 2334 EXPECT_FALSE(resource_entry);
2335 } 2335 }
2336 2336
2337 } // namespace 2337 } // namespace
2338 2338
2339 } // namespace drive 2339 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/drive/fake_drive_service.cc ('k') | chrome/browser/extensions/api/file_handlers/app_file_handler_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698