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

Side by Side Diff: chrome/browser/google_apis/gdata_wapi_parser_unittest.cc

Issue 11428046: Add changestamp field to google_apis::DocumentEntry (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: exclude from android build Created 8 years 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 | « chrome/browser/google_apis/gdata_wapi_parser.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | 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 "chrome/browser/google_apis/gdata_wapi_parser.h" 5 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
6 6
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_file_value_serializer.h" 9 #include "base/json/json_file_value_serializer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 while (reader.Read()) { 47 while (reader.Read()) {
48 if (reader.NodeName() == "entry") { 48 if (reader.NodeName() == "entry") {
49 entry = DocumentEntry::CreateFromXml(&reader); 49 entry = DocumentEntry::CreateFromXml(&reader);
50 break; 50 break;
51 } 51 }
52 } 52 }
53 return entry.release(); 53 return entry.release();
54 } 54 }
55 }; 55 };
56 56
57 // TODO(nhiroki): Make it possible to run these tests on any platforms after 57 // TODO(nhiroki): Move json files to out of 'chromeos' directory
58 // moving json files to out of 'chromeos' directory (http://crbug.com/149788). 58 // (http://crbug.com/149788).
59 #if defined(OS_CHROMEOS)
60 // Test document feed parsing. 59 // Test document feed parsing.
61 TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) { 60 TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) {
62 std::string error; 61 std::string error;
63 scoped_ptr<Value> document = 62 scoped_ptr<Value> document =
64 test_util::LoadJSONFile("gdata/basic_feed.json"); 63 test_util::LoadJSONFile("gdata/basic_feed.json");
65 ASSERT_TRUE(document.get()); 64 ASSERT_TRUE(document.get());
66 ASSERT_EQ(Value::TYPE_DICTIONARY, document->GetType()); 65 ASSERT_EQ(Value::TYPE_DICTIONARY, document->GetType());
67 scoped_ptr<DocumentFeed> feed(DocumentFeed::ExtractAndParse(*document)); 66 scoped_ptr<DocumentFeed> feed(DocumentFeed::ExtractAndParse(*document));
68 ASSERT_TRUE(feed.get()); 67 ASSERT_TRUE(feed.get());
69 68
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 EXPECT_EQ("https://file_link_parent/", file_parent_link->href().spec()); 153 EXPECT_EQ("https://file_link_parent/", file_parent_link->href().spec());
155 EXPECT_EQ("application/atom+xml", file_parent_link->mime_type()); 154 EXPECT_EQ("application/atom+xml", file_parent_link->mime_type());
156 EXPECT_EQ(ASCIIToUTF16("Medical"), file_parent_link->title()); 155 EXPECT_EQ(ASCIIToUTF16("Medical"), file_parent_link->title());
157 const Link* file_open_with_link = 156 const Link* file_open_with_link =
158 file_entry->GetLinkByType(Link::LINK_OPEN_WITH); 157 file_entry->GetLinkByType(Link::LINK_OPEN_WITH);
159 ASSERT_TRUE(file_open_with_link); 158 ASSERT_TRUE(file_open_with_link);
160 EXPECT_EQ("https://xml_file_entry_open_with_link/", 159 EXPECT_EQ("https://xml_file_entry_open_with_link/",
161 file_open_with_link->href().spec()); 160 file_open_with_link->href().spec());
162 EXPECT_EQ("application/atom+xml", file_open_with_link->mime_type()); 161 EXPECT_EQ("application/atom+xml", file_open_with_link->mime_type());
163 EXPECT_EQ("the_app_id", file_open_with_link->app_id()); 162 EXPECT_EQ("the_app_id", file_open_with_link->app_id());
163 EXPECT_EQ(654321, file_entry->changestamp());
164 164
165 const Link* file_unknown_link = file_entry->GetLinkByType(Link::LINK_UNKNOWN); 165 const Link* file_unknown_link = file_entry->GetLinkByType(Link::LINK_UNKNOWN);
166 ASSERT_TRUE(file_unknown_link); 166 ASSERT_TRUE(file_unknown_link);
167 EXPECT_EQ("https://xml_file_fake_entry_open_with_link/", 167 EXPECT_EQ("https://xml_file_fake_entry_open_with_link/",
168 file_unknown_link->href().spec()); 168 file_unknown_link->href().spec());
169 EXPECT_EQ("application/atom+xml", file_unknown_link->mime_type()); 169 EXPECT_EQ("application/atom+xml", file_unknown_link->mime_type());
170 EXPECT_EQ("", file_unknown_link->app_id()); 170 EXPECT_EQ("", file_unknown_link->app_id());
171 171
172 // Check a file entry. 172 // Check a file entry.
173 const DocumentEntry* document_entry = feed->entries()[2]; 173 const DocumentEntry* document_entry = feed->entries()[2];
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 EXPECT_EQ("Drive App 2", UTF16ToUTF8(second_app->app_name())); 329 EXPECT_EQ("Drive App 2", UTF16ToUTF8(second_app->app_name()));
330 EXPECT_EQ("Drive App Object 2", UTF16ToUTF8(second_app->object_type())); 330 EXPECT_EQ("Drive App Object 2", UTF16ToUTF8(second_app->object_type()));
331 EXPECT_EQ("https://chrome.google.com/webstore/detail/deadbeefdeadbeef", 331 EXPECT_EQ("https://chrome.google.com/webstore/detail/deadbeefdeadbeef",
332 second_app->GetProductUrl().spec()); 332 second_app->GetProductUrl().spec());
333 EXPECT_FALSE(second_app->supports_create()); 333 EXPECT_FALSE(second_app->supports_create());
334 EXPECT_EQ(2U, second_app->primary_mimetypes().size()); 334 EXPECT_EQ(2U, second_app->primary_mimetypes().size());
335 EXPECT_EQ(0U, second_app->secondary_mimetypes().size()); 335 EXPECT_EQ(0U, second_app->secondary_mimetypes().size());
336 EXPECT_EQ(1U, second_app->primary_extensions().size()); 336 EXPECT_EQ(1U, second_app->primary_extensions().size());
337 EXPECT_EQ(0U, second_app->secondary_extensions().size()); 337 EXPECT_EQ(0U, second_app->secondary_extensions().size());
338 } 338 }
339 #endif // OS_CHROMEOS
340 339
341 // Test file extension checking in DocumentEntry::HasDocumentExtension(). 340 // Test file extension checking in DocumentEntry::HasDocumentExtension().
342 TEST_F(GDataWAPIParserTest, DocumentEntryHasDocumentExtension) { 341 TEST_F(GDataWAPIParserTest, DocumentEntryHasDocumentExtension) {
343 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 342 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
344 FilePath(FILE_PATH_LITERAL("Test.gdoc")))); 343 FilePath(FILE_PATH_LITERAL("Test.gdoc"))));
345 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 344 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
346 FilePath(FILE_PATH_LITERAL("Test.gsheet")))); 345 FilePath(FILE_PATH_LITERAL("Test.gsheet"))));
347 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 346 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
348 FilePath(FILE_PATH_LITERAL("Test.gslides")))); 347 FilePath(FILE_PATH_LITERAL("Test.gslides"))));
349 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension( 348 EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_EXTERNAL_APP)); 386 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_EXTERNAL_APP));
388 EXPECT_EQ(DocumentEntry::KIND_OF_FOLDER, 387 EXPECT_EQ(DocumentEntry::KIND_OF_FOLDER,
389 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FOLDER)); 388 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FOLDER));
390 EXPECT_EQ(DocumentEntry::KIND_OF_FILE, 389 EXPECT_EQ(DocumentEntry::KIND_OF_FILE,
391 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FILE)); 390 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FILE));
392 EXPECT_EQ(DocumentEntry::KIND_OF_FILE, 391 EXPECT_EQ(DocumentEntry::KIND_OF_FILE,
393 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_PDF)); 392 DocumentEntry::ClassifyEntryKind(ENTRY_KIND_PDF));
394 } 393 }
395 394
396 } // namespace google_apis 395 } // namespace google_apis
OLDNEW
« no previous file with comments | « chrome/browser/google_apis/gdata_wapi_parser.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698