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

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

Issue 216433002: drive: Make FileResource copyable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
« no previous file with comments | « google_apis/drive/drive_api_parser.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/drive_api_parser.h" 5 #include "google_apis/drive/drive_api_parser.h"
6 6
7 #include "base/time/time.h" 7 #include "base/time/time.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "google_apis/drive/gdata_wapi_parser.h" 9 #include "google_apis/drive/gdata_wapi_parser.h"
10 #include "google_apis/drive/test_util.h" 10 #include "google_apis/drive/test_util.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 util::GetTimeFromString("2012-07-24T08:51:16.570Z", &created_time)); 162 util::GetTimeFromString("2012-07-24T08:51:16.570Z", &created_time));
163 EXPECT_EQ(created_time, file1.created_date()); 163 EXPECT_EQ(created_time, file1.created_date());
164 164
165 base::Time modified_time; 165 base::Time modified_time;
166 ASSERT_TRUE( 166 ASSERT_TRUE(
167 util::GetTimeFromString("2012-07-27T05:43:20.269Z", &modified_time)); 167 util::GetTimeFromString("2012-07-27T05:43:20.269Z", &modified_time));
168 EXPECT_EQ(modified_time, file1.modified_date()); 168 EXPECT_EQ(modified_time, file1.modified_date());
169 EXPECT_EQ(modified_time, file1.modified_by_me_date()); 169 EXPECT_EQ(modified_time, file1.modified_by_me_date());
170 170
171 ASSERT_EQ(1U, file1.parents().size()); 171 ASSERT_EQ(1U, file1.parents().size());
172 EXPECT_EQ("0B4v7G8yEYAWHYW1OcExsUVZLABC", file1.parents()[0]->file_id()); 172 EXPECT_EQ("0B4v7G8yEYAWHYW1OcExsUVZLABC", file1.parents()[0].file_id());
173 EXPECT_EQ(GURL("https://www.googleapis.com/drive/v2/files/" 173 EXPECT_EQ(GURL("https://www.googleapis.com/drive/v2/files/"
174 "0B4v7G8yEYAWHYW1OcExsUVZLABC"), 174 "0B4v7G8yEYAWHYW1OcExsUVZLABC"),
175 file1.parents()[0]->parent_link()); 175 file1.parents()[0].parent_link());
176 EXPECT_FALSE(file1.parents()[0]->is_root()); 176 EXPECT_FALSE(file1.parents()[0].is_root());
177 177
178 EXPECT_EQ("ext", file1.file_extension()); 178 EXPECT_EQ("ext", file1.file_extension());
179 EXPECT_EQ("d41d8cd98f00b204e9800998ecf8427e", file1.md5_checksum()); 179 EXPECT_EQ("d41d8cd98f00b204e9800998ecf8427e", file1.md5_checksum());
180 EXPECT_EQ(1000U, file1.file_size()); 180 EXPECT_EQ(1000U, file1.file_size());
181 181
182 EXPECT_EQ(GURL("https://docs.google.com/file/d/" 182 EXPECT_EQ(GURL("https://docs.google.com/file/d/"
183 "0B4v7G8yEYAWHUmRrU2lMS2hLABC/edit"), 183 "0B4v7G8yEYAWHUmRrU2lMS2hLABC/edit"),
184 file1.alternate_link()); 184 file1.alternate_link());
185 ASSERT_EQ(1U, file1.open_with_links().size()); 185 ASSERT_EQ(1U, file1.open_with_links().size());
186 EXPECT_EQ("1234567890", file1.open_with_links()[0].app_id); 186 EXPECT_EQ("1234567890", file1.open_with_links()[0].app_id);
(...skipping 29 matching lines...) Expand all
216 216
217 // Check file 3 (a folder) 217 // Check file 3 (a folder)
218 const FileResource& file3 = *filelist->items()[2]; 218 const FileResource& file3 = *filelist->items()[2];
219 EXPECT_EQ(0U, file3.file_size()); 219 EXPECT_EQ(0U, file3.file_size());
220 EXPECT_EQ("TestFolder", file3.title()); 220 EXPECT_EQ("TestFolder", file3.title());
221 EXPECT_EQ("application/vnd.google-apps.folder", file3.mime_type()); 221 EXPECT_EQ("application/vnd.google-apps.folder", file3.mime_type());
222 ASSERT_TRUE(file3.IsDirectory()); 222 ASSERT_TRUE(file3.IsDirectory());
223 EXPECT_FALSE(file3.shared()); 223 EXPECT_FALSE(file3.shared());
224 224
225 ASSERT_EQ(1U, file3.parents().size()); 225 ASSERT_EQ(1U, file3.parents().size());
226 EXPECT_EQ("0AIv7G8yEYAWHUk9ABC", file3.parents()[0]->file_id()); 226 EXPECT_EQ("0AIv7G8yEYAWHUk9ABC", file3.parents()[0].file_id());
227 EXPECT_TRUE(file3.parents()[0]->is_root()); 227 EXPECT_TRUE(file3.parents()[0].is_root());
228 EXPECT_EQ(0U, file3.open_with_links().size()); 228 EXPECT_EQ(0U, file3.open_with_links().size());
229 } 229 }
230 230
231 // Test change list parsing. 231 // Test change list parsing.
232 TEST(DriveAPIParserTest, ChangeListParser) { 232 TEST(DriveAPIParserTest, ChangeListParser) {
233 std::string error; 233 std::string error;
234 scoped_ptr<base::Value> document = 234 scoped_ptr<base::Value> document =
235 test_util::LoadJSONFile("drive/changelist.json"); 235 test_util::LoadJSONFile("drive/changelist.json");
236 ASSERT_TRUE(document.get()); 236 ASSERT_TRUE(document.get());
237 237
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 test_util::LoadJSONFile("drive/filelist.json")); 290 test_util::LoadJSONFile("drive/filelist.json"));
291 291
292 EXPECT_TRUE(ChangeList::HasChangeListKind(*change_list_json)); 292 EXPECT_TRUE(ChangeList::HasChangeListKind(*change_list_json));
293 EXPECT_FALSE(ChangeList::HasChangeListKind(*file_list_json)); 293 EXPECT_FALSE(ChangeList::HasChangeListKind(*file_list_json));
294 294
295 EXPECT_FALSE(FileList::HasFileListKind(*change_list_json)); 295 EXPECT_FALSE(FileList::HasFileListKind(*change_list_json));
296 EXPECT_TRUE(FileList::HasFileListKind(*file_list_json)); 296 EXPECT_TRUE(FileList::HasFileListKind(*file_list_json));
297 } 297 }
298 298
299 } // namespace google_apis 299 } // namespace google_apis
OLDNEW
« no previous file with comments | « google_apis/drive/drive_api_parser.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698