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

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

Issue 10836205: Parse labels under File resource. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase. Created 8 years, 4 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 ASSERT_EQ(3U, filelist->items().size()); 164 ASSERT_EQ(3U, filelist->items().size());
165 // Check file 1 (a regular file) 165 // Check file 1 (a regular file)
166 const FileResource& file1 = *filelist->items()[0]; 166 const FileResource& file1 = *filelist->items()[0];
167 EXPECT_EQ("0B4v7G8yEYAWHUmRrU2lMS2hLABC", file1.file_id()); 167 EXPECT_EQ("0B4v7G8yEYAWHUmRrU2lMS2hLABC", file1.file_id());
168 EXPECT_EQ("\"WtRjAPZWbDA7_fkFjc5ojsEvDEF/MTM0MzM2NzgwMDIXYZ\"", 168 EXPECT_EQ("\"WtRjAPZWbDA7_fkFjc5ojsEvDEF/MTM0MzM2NzgwMDIXYZ\"",
169 file1.etag()); 169 file1.etag());
170 EXPECT_EQ("My first file data", file1.title()); 170 EXPECT_EQ("My first file data", file1.title());
171 EXPECT_EQ("application/octet-stream", file1.mime_type()); 171 EXPECT_EQ("application/octet-stream", file1.mime_type());
172 172
173 EXPECT_FALSE(file1.labels().is_starred());
174 EXPECT_FALSE(file1.labels().is_hidden());
175 EXPECT_FALSE(file1.labels().is_trashed());
176 EXPECT_FALSE(file1.labels().is_restricted());
177 EXPECT_TRUE(file1.labels().is_viewed());
178
173 base::Time created_time; 179 base::Time created_time;
174 ASSERT_TRUE(gdata::util::GetTimeFromString("2012-07-24T08:51:16.570Z", 180 ASSERT_TRUE(gdata::util::GetTimeFromString("2012-07-24T08:51:16.570Z",
175 &created_time)); 181 &created_time));
176 EXPECT_EQ(created_time, file1.created_date()); 182 EXPECT_EQ(created_time, file1.created_date());
177 183
178 base::Time modified_time; 184 base::Time modified_time;
179 ASSERT_TRUE(gdata::util::GetTimeFromString("2012-07-27T05:43:20.269Z", 185 ASSERT_TRUE(gdata::util::GetTimeFromString("2012-07-27T05:43:20.269Z",
180 &modified_time)); 186 &modified_time));
181 EXPECT_EQ(modified_time, file1.modified_by_me_date()); 187 EXPECT_EQ(modified_time, file1.modified_by_me_date());
182 188
(...skipping 16 matching lines...) Expand all
199 "0B4v7G8yEYAWHUmRrU2lMS2hLABC/edit"), 205 "0B4v7G8yEYAWHUmRrU2lMS2hLABC/edit"),
200 file1.alternate_link()); 206 file1.alternate_link());
201 EXPECT_EQ(GURL("https://docs.google.com/uc?" 207 EXPECT_EQ(GURL("https://docs.google.com/uc?"
202 "id=0B4v7G8yEYAWHUmRrU2lMS2hLABC&export=download"), 208 "id=0B4v7G8yEYAWHUmRrU2lMS2hLABC&export=download"),
203 file1.web_content_link()); 209 file1.web_content_link());
204 210
205 // Check file 2 (a Google Document) 211 // Check file 2 (a Google Document)
206 const FileResource& file2 = *filelist->items()[1]; 212 const FileResource& file2 = *filelist->items()[1];
207 EXPECT_EQ("Test Google Document", file2.title()); 213 EXPECT_EQ("Test Google Document", file2.title());
208 EXPECT_EQ("application/vnd.google-apps.document", file2.mime_type()); 214 EXPECT_EQ("application/vnd.google-apps.document", file2.mime_type());
215
216 EXPECT_TRUE(file2.labels().is_starred());
217 EXPECT_TRUE(file2.labels().is_hidden());
218 EXPECT_TRUE(file2.labels().is_trashed());
219 EXPECT_TRUE(file2.labels().is_restricted());
220 EXPECT_TRUE(file2.labels().is_viewed());
221
209 EXPECT_EQ(0U, file2.file_size()); 222 EXPECT_EQ(0U, file2.file_size());
210 223
211 ASSERT_EQ(0U, file2.parents().size()); 224 ASSERT_EQ(0U, file2.parents().size());
212 225
213 EXPECT_EQ(GURL("https://docs.google.com/a/chromium.org/document/d/" 226 EXPECT_EQ(GURL("https://docs.google.com/a/chromium.org/document/d/"
214 "1Pc8jzfU1ErbN_eucMMqdqzY3eBm0v8sxXm_1CtLxABC/preview"), 227 "1Pc8jzfU1ErbN_eucMMqdqzY3eBm0v8sxXm_1CtLxABC/preview"),
215 file2.embed_link()); 228 file2.embed_link());
216 EXPECT_EQ(GURL("https://docs.google.com/feeds/vt?gd=true&" 229 EXPECT_EQ(GURL("https://docs.google.com/feeds/vt?gd=true&"
217 "id=1Pc8jzfU1ErbN_eucMMqdqzY3eBm0v8sxXm_1CtLxABC&" 230 "id=1Pc8jzfU1ErbN_eucMMqdqzY3eBm0v8sxXm_1CtLxABC&"
218 "v=3&s=AMedNnoAAAAAUBJyB0g8HbxZaLRnlztxefZPS24LiXYZ&sz=s220"), 231 "v=3&s=AMedNnoAAAAAUBJyB0g8HbxZaLRnlztxefZPS24LiXYZ&sz=s220"),
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 EXPECT_FALSE(change2.is_deleted()); 271 EXPECT_FALSE(change2.is_deleted());
259 EXPECT_EQ(change2.file_id(), change2.file().file_id()); 272 EXPECT_EQ(change2.file_id(), change2.file().file_id());
260 273
261 const ChangeResource& change3 = *changelist->items()[2]; 274 const ChangeResource& change3 = *changelist->items()[2];
262 EXPECT_EQ(8429, change3.change_id()); 275 EXPECT_EQ(8429, change3.change_id());
263 EXPECT_FALSE(change3.is_deleted()); 276 EXPECT_FALSE(change3.is_deleted());
264 EXPECT_EQ(change3.file_id(), change3.file().file_id()); 277 EXPECT_EQ(change3.file_id(), change3.file().file_id());
265 } 278 }
266 279
267 } // namespace gdata 280 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/drive_api_parser.cc ('k') | chrome/test/data/chromeos/drive/filelist.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698