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

Side by Side Diff: chrome/browser/chromeos/drive/resource_entry_conversion_unittest.cc

Issue 18355004: google_apis: Move data files out of chrome/test/data/chromeos (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix extension tests Created 7 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 "chrome/browser/chromeos/drive/resource_entry_conversion.h" 5 #include "chrome/browser/chromeos/drive/resource_entry_conversion.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/chromeos/drive/drive.pb.h" 9 #include "chrome/browser/chromeos/drive/drive.pb.h"
10 #include "chrome/browser/chromeos/drive/file_system_util.h" 10 #include "chrome/browser/chromeos/drive/file_system_util.h"
11 #include "chrome/browser/chromeos/drive/test_util.h" 11 #include "chrome/browser/chromeos/drive/test_util.h"
12 #include "chrome/browser/google_apis/gdata_wapi_parser.h" 12 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
15 15
16 namespace drive { 16 namespace drive {
17 17
18 TEST(ResourceEntryConversionTest, ConvertToResourceEntry_File) { 18 TEST(ResourceEntryConversionTest, ConvertToResourceEntry_File) {
19 scoped_ptr<base::Value> value = 19 scoped_ptr<base::Value> value =
20 google_apis::test_util::LoadJSONFile("chromeos/gdata/file_entry.json"); 20 google_apis::test_util::LoadJSONFile("gdata/file_entry.json");
21 ASSERT_TRUE(value.get()); 21 ASSERT_TRUE(value.get());
22 22
23 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry( 23 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry(
24 google_apis::ResourceEntry::ExtractAndParse(*value)); 24 google_apis::ResourceEntry::ExtractAndParse(*value));
25 ASSERT_TRUE(gdata_resource_entry.get()); 25 ASSERT_TRUE(gdata_resource_entry.get());
26 26
27 ResourceEntry entry = 27 ResourceEntry entry =
28 ConvertToResourceEntry(*gdata_resource_entry); 28 ConvertToResourceEntry(*gdata_resource_entry);
29 29
30 EXPECT_EQ("File 1.mp3", entry.title()); 30 EXPECT_EQ("File 1.mp3", entry.title());
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 EXPECT_EQ(892721, entry.file_info().size()); 88 EXPECT_EQ(892721, entry.file_info().size());
89 EXPECT_EQ("3b4382ebefec6e743578c76bbd0575ce", 89 EXPECT_EQ("3b4382ebefec6e743578c76bbd0575ce",
90 entry.file_specific_info().md5()); 90 entry.file_specific_info().md5());
91 EXPECT_FALSE(entry.file_info().is_directory()); 91 EXPECT_FALSE(entry.file_info().is_directory());
92 } 92 }
93 93
94 TEST(ResourceEntryConversionTest, 94 TEST(ResourceEntryConversionTest,
95 ConvertToResourceEntry_HostedDocument) { 95 ConvertToResourceEntry_HostedDocument) {
96 scoped_ptr<base::Value> value = 96 scoped_ptr<base::Value> value =
97 google_apis::test_util::LoadJSONFile( 97 google_apis::test_util::LoadJSONFile(
98 "chromeos/gdata/hosted_document_entry.json"); 98 "gdata/hosted_document_entry.json");
99 ASSERT_TRUE(value.get()); 99 ASSERT_TRUE(value.get());
100 100
101 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry( 101 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry(
102 google_apis::ResourceEntry::ExtractAndParse(*value)); 102 google_apis::ResourceEntry::ExtractAndParse(*value));
103 ASSERT_TRUE(gdata_resource_entry.get()); 103 ASSERT_TRUE(gdata_resource_entry.get());
104 104
105 ResourceEntry entry = 105 ResourceEntry entry =
106 ConvertToResourceEntry(*gdata_resource_entry); 106 ConvertToResourceEntry(*gdata_resource_entry);
107 107
108 EXPECT_EQ("Document 1", entry.title()); 108 EXPECT_EQ("Document 1", entry.title());
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 // The size should be 0 for a hosted document. 170 // The size should be 0 for a hosted document.
171 EXPECT_EQ(0, entry.file_info().size()); 171 EXPECT_EQ(0, entry.file_info().size());
172 EXPECT_FALSE(entry.file_info().is_directory()); 172 EXPECT_FALSE(entry.file_info().is_directory());
173 } 173 }
174 174
175 TEST(ResourceEntryConversionTest, 175 TEST(ResourceEntryConversionTest,
176 ConvertToResourceEntry_Directory) { 176 ConvertToResourceEntry_Directory) {
177 scoped_ptr<base::Value> value = 177 scoped_ptr<base::Value> value =
178 google_apis::test_util::LoadJSONFile( 178 google_apis::test_util::LoadJSONFile(
179 "chromeos/gdata/directory_entry.json"); 179 "gdata/directory_entry.json");
180 ASSERT_TRUE(value.get()); 180 ASSERT_TRUE(value.get());
181 181
182 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry( 182 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry(
183 google_apis::ResourceEntry::ExtractAndParse(*value)); 183 google_apis::ResourceEntry::ExtractAndParse(*value));
184 ASSERT_TRUE(gdata_resource_entry.get()); 184 ASSERT_TRUE(gdata_resource_entry.get());
185 185
186 ResourceEntry entry = 186 ResourceEntry entry =
187 ConvertToResourceEntry(*gdata_resource_entry); 187 ConvertToResourceEntry(*gdata_resource_entry);
188 188
189 EXPECT_EQ("Sub Directory Folder", entry.title()); 189 EXPECT_EQ("Sub Directory Folder", entry.title());
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 EXPECT_EQ(expected_creation_time.ToInternalValue(), 240 EXPECT_EQ(expected_creation_time.ToInternalValue(),
241 entry.file_info().creation_time()); 241 entry.file_info().creation_time());
242 242
243 EXPECT_TRUE(entry.file_info().is_directory()); 243 EXPECT_TRUE(entry.file_info().is_directory());
244 } 244 }
245 245
246 TEST(ResourceEntryConversionTest, 246 TEST(ResourceEntryConversionTest,
247 ConvertToResourceEntry_DeletedHostedDocument) { 247 ConvertToResourceEntry_DeletedHostedDocument) {
248 scoped_ptr<base::Value> value = 248 scoped_ptr<base::Value> value =
249 google_apis::test_util::LoadJSONFile( 249 google_apis::test_util::LoadJSONFile(
250 "chromeos/gdata/deleted_hosted_document_entry.json"); 250 "gdata/deleted_hosted_document_entry.json");
251 ASSERT_TRUE(value.get()); 251 ASSERT_TRUE(value.get());
252 252
253 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry( 253 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry(
254 google_apis::ResourceEntry::ExtractAndParse(*value)); 254 google_apis::ResourceEntry::ExtractAndParse(*value));
255 ASSERT_TRUE(gdata_resource_entry.get()); 255 ASSERT_TRUE(gdata_resource_entry.get());
256 256
257 ResourceEntry entry = 257 ResourceEntry entry =
258 ConvertToResourceEntry(*gdata_resource_entry); 258 ConvertToResourceEntry(*gdata_resource_entry);
259 259
260 EXPECT_EQ("Deleted document", entry.title()); 260 EXPECT_EQ("Deleted document", entry.title());
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 EXPECT_EQ("", 320 EXPECT_EQ("",
321 entry.file_specific_info().share_url()); 321 entry.file_specific_info().share_url());
322 322
323 // The size should be 0 for a hosted document. 323 // The size should be 0 for a hosted document.
324 EXPECT_EQ(0, entry.file_info().size()); 324 EXPECT_EQ(0, entry.file_info().size());
325 } 325 }
326 326
327 TEST(ResourceEntryConversionTest, 327 TEST(ResourceEntryConversionTest,
328 ConvertToResourceEntry_SharedWithMeEntry) { 328 ConvertToResourceEntry_SharedWithMeEntry) {
329 scoped_ptr<base::Value> value = google_apis::test_util::LoadJSONFile( 329 scoped_ptr<base::Value> value = google_apis::test_util::LoadJSONFile(
330 "chromeos/gdata/shared_with_me_entry.json"); 330 "gdata/shared_with_me_entry.json");
331 ASSERT_TRUE(value.get()); 331 ASSERT_TRUE(value.get());
332 332
333 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry( 333 scoped_ptr<google_apis::ResourceEntry> gdata_resource_entry(
334 google_apis::ResourceEntry::ExtractAndParse(*value)); 334 google_apis::ResourceEntry::ExtractAndParse(*value));
335 ASSERT_TRUE(gdata_resource_entry.get()); 335 ASSERT_TRUE(gdata_resource_entry.get());
336 336
337 ResourceEntry entry = 337 ResourceEntry entry =
338 ConvertToResourceEntry(*gdata_resource_entry); 338 ConvertToResourceEntry(*gdata_resource_entry);
339 339
340 EXPECT_TRUE(entry.shared_with_me()); 340 EXPECT_TRUE(entry.shared_with_me());
341 } 341 }
342 342
343 } // namespace drive 343 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/job_scheduler_unittest.cc ('k') | chrome/browser/chromeos/drive/sync_client_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698