summaryrefslogtreecommitdiffstats
path: root/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-10 01:17:16 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-10 01:17:16 +0000
commit5d9226721d2933a3eaa5fd7a27387d5cc010d3a9 (patch)
tree1ca0a03f2470092427679c61afd4acbfc727fe54 /chrome/browser/google_apis/gdata_wapi_parser_unittest.cc
parentfee7b59ea7dfacffea9e25f29606a0de353ce70a (diff)
downloadchromium_src-5d9226721d2933a3eaa5fd7a27387d5cc010d3a9.zip
chromium_src-5d9226721d2933a3eaa5fd7a27387d5cc010d3a9.tar.gz
chromium_src-5d9226721d2933a3eaa5fd7a27387d5cc010d3a9.tar.bz2
clean-up: Purge ambiguous uses of the term "Document".
In Drive/GData code, sometimes it meant a hosted document like Spreadsheet, and sometimes meant general entries (regular files / hosted documents / collections) on Drive. This patch disambiguates them by the following 5 renamings. - DocumentEntry => ResourceEntry. - GetDocuments => GetResourceList. - DownloadDocument => DownloadHostedDocument. - CopyDocument => CopyHostedDocument. - DeleteDocument => DeleteResource. Along the way, also clarified some parameter names. - {document_url, resource_url} => {edit_url, content_url} BUG=164090 TBR=sky@chromium.org (tbr for chrome_browser gyp change) Review URL: https://codereview.chromium.org/11468019 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@172018 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/google_apis/gdata_wapi_parser_unittest.cc')
-rw-r--r--chrome/browser/google_apis/gdata_wapi_parser_unittest.cc112
1 files changed, 56 insertions, 56 deletions
diff --git a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc
index 006cb96..aa85102 100644
--- a/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_parser_unittest.cc
@@ -27,7 +27,7 @@ namespace google_apis {
class GDataWAPIParserTest : public testing::Test {
protected:
- static DocumentEntry* LoadDocumentEntryFromXml(const std::string& filename) {
+ static ResourceEntry* LoadResourceEntryFromXml(const std::string& filename) {
FilePath path;
std::string error;
PathService::Get(chrome::DIR_TEST_DATA, &path);
@@ -43,10 +43,10 @@ class GDataWAPIParserTest : public testing::Test {
NOTREACHED() << "Invalid xml:\n" << contents;
return NULL;
}
- scoped_ptr<DocumentEntry> entry;
+ scoped_ptr<ResourceEntry> entry;
while (reader.Read()) {
if (reader.NodeName() == "entry") {
- entry = DocumentEntry::CreateFromXml(&reader);
+ entry = ResourceEntry::CreateFromXml(&reader);
break;
}
}
@@ -98,7 +98,7 @@ TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) {
ASSERT_EQ(4U, feed->entries().size());
// Check a folder entry.
- const DocumentEntry* folder_entry = feed->entries()[0];
+ const ResourceEntry* folder_entry = feed->entries()[0];
ASSERT_TRUE(folder_entry);
EXPECT_EQ(ENTRY_KIND_FOLDER, folder_entry->kind());
EXPECT_EQ("\"HhMOFgcNHSt7ImBr\"", folder_entry->etag());
@@ -140,7 +140,7 @@ TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) {
EXPECT_EQ("application/atom+xml", entry1_edit_link->mime_type());
// Check a file entry.
- const DocumentEntry* file_entry = feed->entries()[1];
+ const ResourceEntry* file_entry = feed->entries()[1];
ASSERT_TRUE(file_entry);
EXPECT_EQ(ENTRY_KIND_FILE, file_entry->kind());
EXPECT_EQ(ASCIIToUTF16("filename.m4a"), file_entry->filename());
@@ -170,15 +170,15 @@ TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) {
EXPECT_EQ("", file_unknown_link->app_id());
// Check a file entry.
- const DocumentEntry* document_entry = feed->entries()[2];
- ASSERT_TRUE(document_entry);
- EXPECT_EQ(ENTRY_KIND_DOCUMENT, document_entry->kind());
- EXPECT_TRUE(document_entry->is_hosted_document());
- EXPECT_TRUE(document_entry->is_google_document());
- EXPECT_FALSE(document_entry->is_external_document());
+ const ResourceEntry* resource_entry = feed->entries()[2];
+ ASSERT_TRUE(resource_entry);
+ EXPECT_EQ(ENTRY_KIND_DOCUMENT, resource_entry->kind());
+ EXPECT_TRUE(resource_entry->is_hosted_document());
+ EXPECT_TRUE(resource_entry->is_google_document());
+ EXPECT_FALSE(resource_entry->is_external_document());
// Check an external document entry.
- const DocumentEntry* app_entry = feed->entries()[3];
+ const ResourceEntry* app_entry = feed->entries()[3];
ASSERT_TRUE(app_entry);
EXPECT_EQ(ENTRY_KIND_EXTERNAL_APP, app_entry->kind());
EXPECT_TRUE(app_entry->is_hosted_document());
@@ -188,8 +188,8 @@ TEST_F(GDataWAPIParserTest, DocumentFeedJsonParser) {
// Test document feed parsing.
-TEST_F(GDataWAPIParserTest, DocumentEntryXmlParser) {
- scoped_ptr<DocumentEntry> entry(LoadDocumentEntryFromXml("entry.xml"));
+TEST_F(GDataWAPIParserTest, ResourceEntryXmlParser) {
+ scoped_ptr<ResourceEntry> entry(LoadResourceEntryFromXml("entry.xml"));
ASSERT_TRUE(entry.get());
EXPECT_EQ(ENTRY_KIND_FILE, entry->kind());
@@ -337,59 +337,59 @@ TEST_F(GDataWAPIParserTest, AccountMetadataFeedParser) {
EXPECT_EQ(0U, second_app->secondary_extensions().size());
}
-// Test file extension checking in DocumentEntry::HasDocumentExtension().
-TEST_F(GDataWAPIParserTest, DocumentEntryHasDocumentExtension) {
- EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
+// Test file extension checking in ResourceEntry::HasDocumentExtension().
+TEST_F(GDataWAPIParserTest, ResourceEntryHasDocumentExtension) {
+ EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension(
FilePath(FILE_PATH_LITERAL("Test.gdoc"))));
- EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
+ EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension(
FilePath(FILE_PATH_LITERAL("Test.gsheet"))));
- EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
+ EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension(
FilePath(FILE_PATH_LITERAL("Test.gslides"))));
- EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
+ EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension(
FilePath(FILE_PATH_LITERAL("Test.gdraw"))));
- EXPECT_TRUE(DocumentEntry::HasHostedDocumentExtension(
+ EXPECT_TRUE(ResourceEntry::HasHostedDocumentExtension(
FilePath(FILE_PATH_LITERAL("Test.gtable"))));
- EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension(
+ EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension(
FilePath(FILE_PATH_LITERAL("Test.tar.gz"))));
- EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension(
+ EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension(
FilePath(FILE_PATH_LITERAL("Test.txt"))));
- EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension(
+ EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension(
FilePath(FILE_PATH_LITERAL("Test"))));
- EXPECT_FALSE(DocumentEntry::HasHostedDocumentExtension(
+ EXPECT_FALSE(ResourceEntry::HasHostedDocumentExtension(
FilePath(FILE_PATH_LITERAL(""))));
}
-TEST_F(GDataWAPIParserTest, DocumentEntryClassifyEntryKind) {
- EXPECT_EQ(DocumentEntry::KIND_OF_NONE,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_UNKNOWN));
- EXPECT_EQ(DocumentEntry::KIND_OF_NONE,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_ITEM));
- EXPECT_EQ(DocumentEntry::KIND_OF_NONE,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_SITE));
- EXPECT_EQ(DocumentEntry::KIND_OF_GOOGLE_DOCUMENT |
- DocumentEntry::KIND_OF_HOSTED_DOCUMENT,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_DOCUMENT));
- EXPECT_EQ(DocumentEntry::KIND_OF_GOOGLE_DOCUMENT |
- DocumentEntry::KIND_OF_HOSTED_DOCUMENT,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_SPREADSHEET));
- EXPECT_EQ(DocumentEntry::KIND_OF_GOOGLE_DOCUMENT |
- DocumentEntry::KIND_OF_HOSTED_DOCUMENT,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_PRESENTATION));
- EXPECT_EQ(DocumentEntry::KIND_OF_GOOGLE_DOCUMENT |
- DocumentEntry::KIND_OF_HOSTED_DOCUMENT,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_DRAWING));
- EXPECT_EQ(DocumentEntry::KIND_OF_GOOGLE_DOCUMENT |
- DocumentEntry::KIND_OF_HOSTED_DOCUMENT,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_TABLE));
- EXPECT_EQ(DocumentEntry::KIND_OF_EXTERNAL_DOCUMENT |
- DocumentEntry::KIND_OF_HOSTED_DOCUMENT,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_EXTERNAL_APP));
- EXPECT_EQ(DocumentEntry::KIND_OF_FOLDER,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FOLDER));
- EXPECT_EQ(DocumentEntry::KIND_OF_FILE,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_FILE));
- EXPECT_EQ(DocumentEntry::KIND_OF_FILE,
- DocumentEntry::ClassifyEntryKind(ENTRY_KIND_PDF));
+TEST_F(GDataWAPIParserTest, ResourceEntryClassifyEntryKind) {
+ EXPECT_EQ(ResourceEntry::KIND_OF_NONE,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_UNKNOWN));
+ EXPECT_EQ(ResourceEntry::KIND_OF_NONE,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_ITEM));
+ EXPECT_EQ(ResourceEntry::KIND_OF_NONE,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_SITE));
+ EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
+ ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_DOCUMENT));
+ EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
+ ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_SPREADSHEET));
+ EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
+ ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_PRESENTATION));
+ EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
+ ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_DRAWING));
+ EXPECT_EQ(ResourceEntry::KIND_OF_GOOGLE_DOCUMENT |
+ ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_TABLE));
+ EXPECT_EQ(ResourceEntry::KIND_OF_EXTERNAL_DOCUMENT |
+ ResourceEntry::KIND_OF_HOSTED_DOCUMENT,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_EXTERNAL_APP));
+ EXPECT_EQ(ResourceEntry::KIND_OF_FOLDER,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_FOLDER));
+ EXPECT_EQ(ResourceEntry::KIND_OF_FILE,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_FILE));
+ EXPECT_EQ(ResourceEntry::KIND_OF_FILE,
+ ResourceEntry::ClassifyEntryKind(ENTRY_KIND_PDF));
}
} // namespace google_apis