summaryrefslogtreecommitdiffstats
path: root/chrome/browser/google_apis
diff options
context:
space:
mode:
authorharuki@chromium.org <haruki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-13 01:23:31 +0000
committerharuki@chromium.org <haruki@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-13 01:23:31 +0000
commit57596f661a40678e481068efed130375ce46a72c (patch)
tree344ddd6171982bc363a4afb15b94983e302acc8f /chrome/browser/google_apis
parentc8031f8f8dfb16e7dd4ef374f39fbaaf9d450b3d (diff)
downloadchromium_src-57596f661a40678e481068efed130375ce46a72c.zip
chromium_src-57596f661a40678e481068efed130375ce46a72c.tar.gz
chromium_src-57596f661a40678e481068efed130375ce46a72c.tar.bz2
drive: Add showroot=true to WAPI feed URLs and ignore "no parent" entries.
Forces DriveResourceMetadata to completely reject "no parent" entries (except the root). Makes ChangeListLoader to ignore "no parent" entries coming from the server. showroot=true lets us know the entries belonging to the "My Drive" root, so this CL only impacts the entries those are not in "My Drive". e.g. shared-with-me entries and entries the user (or a Drive app) explicitly set "no parent". BUG=174233,164119 TEST=unittests. Open Files App and verify Google Drive is available. Note that this CL changes the behavior about "no parent" entries. Review URL: https://chromiumcodereview.appspot.com/12585003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187734 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/google_apis')
-rw-r--r--chrome/browser/google_apis/fake_drive_service_unittest.cc2
-rw-r--r--chrome/browser/google_apis/gdata_wapi_operations_unittest.cc58
-rw-r--r--chrome/browser/google_apis/gdata_wapi_url_generator.cc1
-rw-r--r--chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc48
4 files changed, 62 insertions, 47 deletions
diff --git a/chrome/browser/google_apis/fake_drive_service_unittest.cc b/chrome/browser/google_apis/fake_drive_service_unittest.cc
index db4bd4f..66e7bd5 100644
--- a/chrome/browser/google_apis/fake_drive_service_unittest.cc
+++ b/chrome/browser/google_apis/fake_drive_service_unittest.cc
@@ -225,7 +225,7 @@ TEST_F(FakeDriveServiceTest, GetResourceList_InRootDirectory) {
EXPECT_EQ(HTTP_SUCCESS, error);
ASSERT_TRUE(resource_list);
// Do some sanity check. There are 7 entries in the root directory.
- EXPECT_EQ(7U, resource_list->entries().size());
+ EXPECT_EQ(8U, resource_list->entries().size());
EXPECT_EQ(1, fake_service_.resource_list_load_count());
}
diff --git a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
index 4d7b3c3..ec76982 100644
--- a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
@@ -347,8 +347,8 @@ TEST_F(GDataWapiOperationsTest, GetResourceListOperation_DefaultFeed) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ("/feeds/default/private/full/-/mine?v=3&alt=json&showfolders=true"
- "&max-results=500&include-installed-apps=true",
+ EXPECT_EQ("/feeds/default/private/full/-/mine?v=3&alt=json&showroot=true&"
+ "showfolders=true&max-results=500&include-installed-apps=true",
http_request_.relative_url);
EXPECT_TRUE(test_util::VerifyJsonData(
test_util::GetTestFilePath("chromeos/gdata/root_feed.json"),
@@ -377,8 +377,8 @@ TEST_F(GDataWapiOperationsTest, GetResourceListOperation_ValidFeed) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ("/files/chromeos/gdata/root_feed.json?v=3&alt=json&showfolders=true"
- "&max-results=500&include-installed-apps=true",
+ EXPECT_EQ("/files/chromeos/gdata/root_feed.json?v=3&alt=json&showroot=true&"
+ "showfolders=true&max-results=500&include-installed-apps=true",
http_request_.relative_url);
EXPECT_TRUE(test_util::VerifyJsonData(
test_util::GetTestFilePath("chromeos/gdata/root_feed.json"),
@@ -409,8 +409,8 @@ TEST_F(GDataWapiOperationsTest, GetResourceListOperation_InvalidFeed) {
EXPECT_EQ(GDATA_PARSE_ERROR, result_code);
EXPECT_EQ(test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ("/files/chromeos/gdata/testfile.txt?v=3&alt=json&showfolders=true"
- "&max-results=500&include-installed-apps=true",
+ EXPECT_EQ("/files/chromeos/gdata/testfile.txt?v=3&alt=json&showroot=true&"
+ "showfolders=true&max-results=500&include-installed-apps=true",
http_request_.relative_url);
EXPECT_FALSE(result_data);
}
@@ -434,7 +434,7 @@ TEST_F(GDataWapiOperationsTest, GetResourceEntryOperation_ValidResourceId) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_GET, http_request_.method);
EXPECT_EQ("/feeds/default/private/full/file%3A2_file_resource_id"
- "?v=3&alt=json",
+ "?v=3&alt=json&showroot=true",
http_request_.relative_url);
EXPECT_TRUE(test_util::VerifyJsonData(
test_util::GetTestFilePath("chromeos/gdata/file_entry.json"),
@@ -459,7 +459,8 @@ TEST_F(GDataWapiOperationsTest, GetResourceEntryOperation_InvalidResourceId) {
EXPECT_EQ(HTTP_NOT_FOUND, result_code);
EXPECT_EQ(test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ("/feeds/default/private/full/%3Cinvalid%3E?v=3&alt=json",
+ EXPECT_EQ("/feeds/default/private/full/%3Cinvalid%3E?v=3&alt=json"
+ "&showroot=true",
http_request_.relative_url);
ASSERT_FALSE(result_data);
}
@@ -481,7 +482,8 @@ TEST_F(GDataWapiOperationsTest, GetAccountMetadataOperation) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ("/feeds/metadata/default?v=3&alt=json&include-installed-apps=true",
+ EXPECT_EQ("/feeds/metadata/default?v=3&alt=json&showroot=true"
+ "&include-installed-apps=true",
http_request_.relative_url);
scoped_ptr<AccountMetadata> expected(
@@ -519,7 +521,7 @@ TEST_F(GDataWapiOperationsTest,
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ("/feeds/metadata/default?v=3&alt=json",
+ EXPECT_EQ("/feeds/metadata/default?v=3&alt=json&showroot=true",
http_request_.relative_url);
scoped_ptr<AccountMetadata> expected(
@@ -557,7 +559,8 @@ TEST_F(GDataWapiOperationsTest, DeleteResourceOperation) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_DELETE, http_request_.method);
EXPECT_EQ(
- "/feeds/default/private/full/file%3A2_file_resource_id?v=3&alt=json",
+ "/feeds/default/private/full/file%3A2_file_resource_id?v=3&alt=json"
+ "&showroot=true",
http_request_.relative_url);
EXPECT_EQ("*", http_request_.headers["If-Match"]);
}
@@ -581,7 +584,8 @@ TEST_F(GDataWapiOperationsTest, DeleteResourceOperationWithETag) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_DELETE, http_request_.method);
EXPECT_EQ(
- "/feeds/default/private/full/file%3A2_file_resource_id?v=3&alt=json",
+ "/feeds/default/private/full/file%3A2_file_resource_id?v=3&alt=json"
+ "&showroot=true",
http_request_.relative_url);
EXPECT_EQ("etag", http_request_.headers["If-Match"]);
}
@@ -607,7 +611,8 @@ TEST_F(GDataWapiOperationsTest, CreateDirectoryOperation) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_POST, http_request_.method);
- EXPECT_EQ("/feeds/default/private/full/folder%3Aroot/contents?v=3&alt=json",
+ EXPECT_EQ("/feeds/default/private/full/folder%3Aroot/contents?v=3&alt=json"
+ "&showroot=true",
http_request_.relative_url);
EXPECT_EQ("application/atom+xml", http_request_.headers["Content-Type"]);
@@ -642,7 +647,7 @@ TEST_F(GDataWapiOperationsTest, CopyHostedDocumentOperation) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_POST, http_request_.method);
- EXPECT_EQ("/feeds/default/private/full?v=3&alt=json",
+ EXPECT_EQ("/feeds/default/private/full?v=3&alt=json&showroot=true",
http_request_.relative_url);
EXPECT_EQ("application/atom+xml", http_request_.headers["Content-Type"]);
@@ -675,7 +680,8 @@ TEST_F(GDataWapiOperationsTest, RenameResourceOperation) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_PUT, http_request_.method);
EXPECT_EQ(
- "/feeds/default/private/full/file%3A2_file_resource_id?v=3&alt=json",
+ "/feeds/default/private/full/file%3A2_file_resource_id?v=3&alt=json"
+ "&showroot=true",
http_request_.relative_url);
EXPECT_EQ("application/atom+xml", http_request_.headers["Content-Type"]);
EXPECT_EQ("*", http_request_.headers["If-Match"]);
@@ -709,7 +715,8 @@ TEST_F(GDataWapiOperationsTest, AuthorizeAppOperation_ValidFeed) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_PUT, http_request_.method);
- EXPECT_EQ("/feeds/default/private/full/file:2_file_resource_id?v=3&alt=json",
+ EXPECT_EQ("/feeds/default/private/full/file:2_file_resource_id?v=3&alt=json"
+ "&showroot=true",
http_request_.relative_url);
EXPECT_EQ("application/atom+xml", http_request_.headers["Content-Type"]);
EXPECT_EQ("*", http_request_.headers["If-Match"]);
@@ -743,7 +750,7 @@ TEST_F(GDataWapiOperationsTest, AuthorizeAppOperation_InvalidFeed) {
EXPECT_EQ(GDATA_PARSE_ERROR, result_code);
EXPECT_EQ(test_server::METHOD_PUT, http_request_.method);
- EXPECT_EQ("/files/chromeos/gdata/testfile.txt?v=3&alt=json",
+ EXPECT_EQ("/files/chromeos/gdata/testfile.txt?v=3&alt=json&showroot=true",
http_request_.relative_url);
EXPECT_EQ("application/atom+xml", http_request_.headers["Content-Type"]);
EXPECT_EQ("*", http_request_.headers["If-Match"]);
@@ -777,7 +784,8 @@ TEST_F(GDataWapiOperationsTest, AddResourceToDirectoryOperation) {
EXPECT_EQ(HTTP_SUCCESS, result_code);
EXPECT_EQ(test_server::METHOD_POST, http_request_.method);
- EXPECT_EQ("/feeds/default/private/full/folder%3Aroot/contents?v=3&alt=json",
+ EXPECT_EQ("/feeds/default/private/full/folder%3Aroot/contents?v=3&alt=json"
+ "&showroot=true",
http_request_.relative_url);
EXPECT_EQ("application/atom+xml", http_request_.headers["Content-Type"]);
@@ -812,7 +820,7 @@ TEST_F(GDataWapiOperationsTest, RemoveResourceFromDirectoryOperation) {
// DELETE method should be used, without the body content.
EXPECT_EQ(test_server::METHOD_DELETE, http_request_.method);
EXPECT_EQ("/feeds/default/private/full/folder%3Aroot/contents/"
- "file%3A2_file_resource_id?v=3&alt=json",
+ "file%3A2_file_resource_id?v=3&alt=json&showroot=true",
http_request_.relative_url);
EXPECT_EQ("*", http_request_.headers["If-Match"]);
EXPECT_FALSE(http_request_.has_content);
@@ -851,7 +859,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewFile) {
// convert=false should be passed as files should be uploaded as-is.
EXPECT_EQ(
"/feeds/upload/create-session/default/private/full/folder%3Aid/contents"
- "?convert=false&v=3&alt=json",
+ "?convert=false&v=3&alt=json&showroot=true",
http_request_.relative_url);
EXPECT_EQ("text/plain", http_request_.headers["X-Upload-Content-Type"]);
EXPECT_EQ("application/atom+xml", http_request_.headers["Content-Type"]);
@@ -952,7 +960,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewLargeFile) {
// convert=false should be passed as files should be uploaded as-is.
EXPECT_EQ(
"/feeds/upload/create-session/default/private/full/folder%3Aid/contents"
- "?convert=false&v=3&alt=json",
+ "?convert=false&v=3&alt=json&showroot=true",
http_request_.relative_url);
EXPECT_EQ("text/plain", http_request_.headers["X-Upload-Content-Type"]);
EXPECT_EQ("application/atom+xml", http_request_.headers["Content-Type"]);
@@ -1149,7 +1157,7 @@ TEST_F(GDataWapiOperationsTest, UploadNewEmptyFile) {
// convert=false should be passed as files should be uploaded as-is.
EXPECT_EQ(
"/feeds/upload/create-session/default/private/full/folder%3Aid/contents"
- "?convert=false&v=3&alt=json",
+ "?convert=false&v=3&alt=json&showroot=true",
http_request_.relative_url);
EXPECT_EQ("text/plain", http_request_.headers["X-Upload-Content-Type"]);
EXPECT_EQ("application/atom+xml", http_request_.headers["Content-Type"]);
@@ -1241,7 +1249,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFile) {
EXPECT_EQ(test_server::METHOD_PUT, http_request_.method);
// convert=false should be passed as files should be uploaded as-is.
EXPECT_EQ("/feeds/upload/create-session/default/private/full/file%3Afoo"
- "?convert=false&v=3&alt=json",
+ "?convert=false&v=3&alt=json&showroot=true",
http_request_.relative_url);
// Even though the body is empty, the content type should be set to
// "text/plain".
@@ -1334,7 +1342,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFileWithETag) {
EXPECT_EQ(test_server::METHOD_PUT, http_request_.method);
// convert=false should be passed as files should be uploaded as-is.
EXPECT_EQ("/feeds/upload/create-session/default/private/full/file%3Afoo"
- "?convert=false&v=3&alt=json",
+ "?convert=false&v=3&alt=json&showroot=true",
http_request_.relative_url);
// Even though the body is empty, the content type should be set to
// "text/plain".
@@ -1426,7 +1434,7 @@ TEST_F(GDataWapiOperationsTest, UploadExistingFileWithETagConflict) {
EXPECT_EQ(test_server::METHOD_PUT, http_request_.method);
// convert=false should be passed as files should be uploaded as-is.
EXPECT_EQ("/feeds/upload/create-session/default/private/full/file%3Afoo"
- "?convert=false&v=3&alt=json",
+ "?convert=false&v=3&alt=json&showroot=true",
http_request_.relative_url);
// Even though the body is empty, the content type should be set to
// "text/plain".
diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator.cc b/chrome/browser/google_apis/gdata_wapi_url_generator.cc
index 1cdcdc9..ff4c8ed 100644
--- a/chrome/browser/google_apis/gdata_wapi_url_generator.cc
+++ b/chrome/browser/google_apis/gdata_wapi_url_generator.cc
@@ -78,6 +78,7 @@ const char GDataWapiUrlGenerator::kBaseUrlForProduction[] =
GURL GDataWapiUrlGenerator::AddStandardUrlParams(const GURL& url) {
GURL result = net::AppendOrReplaceQueryParameter(url, "v", "3");
result = net::AppendOrReplaceQueryParameter(result, "alt", "json");
+ result = net::AppendOrReplaceQueryParameter(result, "showroot", "true");
return result;
}
diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc b/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc
index b81394c..ba5f041 100644
--- a/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc
@@ -20,19 +20,20 @@ class GDataWapiUrlGeneratorTest : public testing::Test {
};
TEST_F(GDataWapiUrlGeneratorTest, AddStandardUrlParams) {
- EXPECT_EQ("http://www.example.com/?v=3&alt=json",
+ EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true",
GDataWapiUrlGenerator::AddStandardUrlParams(
GURL("http://www.example.com")).spec());
}
TEST_F(GDataWapiUrlGeneratorTest, AddInitiateUploadUrlParams) {
- EXPECT_EQ("http://www.example.com/?convert=false&v=3&alt=json",
+ EXPECT_EQ("http://www.example.com/?convert=false&v=3&alt=json&showroot=true",
GDataWapiUrlGenerator::AddInitiateUploadUrlParams(
GURL("http://www.example.com")).spec());
}
TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) {
- EXPECT_EQ("http://www.example.com/?v=3&alt=json&showfolders=true"
+ EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true&"
+ "showfolders=true"
"&max-results=100"
"&include-installed-apps=true",
GDataWapiUrlGenerator::AddFeedUrlParams(
@@ -41,7 +42,8 @@ TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) {
0, // changestamp
"" // search_string
).spec());
- EXPECT_EQ("http://www.example.com/?v=3&alt=json&showfolders=true"
+ EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true&"
+ "showfolders=true"
"&max-results=100"
"&include-installed-apps=true"
"&start-index=123",
@@ -51,7 +53,8 @@ TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) {
123, // changestamp
"" // search_string
).spec());
- EXPECT_EQ("http://www.example.com/?v=3&alt=json&showfolders=true"
+ EXPECT_EQ("http://www.example.com/?v=3&alt=json&showroot=true&"
+ "showfolders=true"
"&max-results=100"
"&include-installed-apps=true"
"&start-index=123"
@@ -68,7 +71,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// This is the very basic URL for the GetResourceList operation.
EXPECT_EQ(
"https://docs.google.com/feeds/default/private/full/-/mine"
- "?v=3&alt=json&showfolders=true&max-results=500"
+ "?v=3&alt=json&showroot=true&showfolders=true&max-results=500"
"&include-installed-apps=true",
url_generator_.GenerateResourceListUrl(GURL(), // override_url,
0, // start_changestamp,
@@ -81,7 +84,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// parameters remain as-is.
EXPECT_EQ(
"http://localhost/"
- "?v=3&alt=json&showfolders=true&max-results=500"
+ "?v=3&alt=json&showroot=true&showfolders=true&max-results=500"
"&include-installed-apps=true",
url_generator_.GenerateResourceListUrl(
GURL("http://localhost/"), // override_url,
@@ -95,7 +98,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// "full/-/mine" to "changes", and "start-index" parameter is added.
EXPECT_EQ(
"https://docs.google.com/feeds/default/private/changes"
- "?v=3&alt=json&showfolders=true&max-results=500"
+ "?v=3&alt=json&showroot=true&showfolders=true&max-results=500"
"&include-installed-apps=true"
"&start-index=100",
url_generator_.GenerateResourceListUrl(GURL(), // override_url,
@@ -109,7 +112,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// and "q" parameter is added.
EXPECT_EQ(
"https://docs.google.com/feeds/default/private/full/-/mine"
- "?v=3&alt=json&showfolders=true&max-results=50"
+ "?v=3&alt=json&showroot=true&showfolders=true&max-results=50"
"&include-installed-apps=true&q=foo",
url_generator_.GenerateResourceListUrl(GURL(), // override_url,
0, // start_changestamp,
@@ -122,7 +125,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// the default parameters remain.
EXPECT_EQ(
"https://docs.google.com/feeds/default/private/full/-/shared-with-me"
- "?v=3&alt=json&showfolders=true&max-results=500"
+ "?v=3&alt=json&showroot=true&showfolders=true&max-results=500"
"&include-installed-apps=true",
url_generator_.GenerateResourceListUrl(GURL(), // override_url,
0, // start_changestamp,
@@ -135,7 +138,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// changed, but the default parameters remain.
EXPECT_EQ(
"https://docs.google.com/feeds/default/private/full/XXX/contents/-/mine"
- "?v=3&alt=json&showfolders=true&max-results=500"
+ "?v=3&alt=json&showroot=true&showfolders=true&max-results=500"
"&include-installed-apps=true",
url_generator_.GenerateResourceListUrl(GURL(), // override_url,
0, // start_changestamp,
@@ -149,8 +152,8 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// overridden.
EXPECT_EQ(
"http://example.com/"
- "?start-index=123&v=3&alt=json&showfolders=true&max-results=500"
- "&include-installed-apps=true",
+ "?start-index=123&v=3&alt=json&showroot=true&showfolders=true"
+ "&max-results=500&include-installed-apps=true",
url_generator_.GenerateResourceListUrl(
GURL("http://example.com/?start-index=123"), // override_url,
100, // start_changestamp,
@@ -162,7 +165,8 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
TEST_F(GDataWapiUrlGeneratorTest, GenerateEditUrl) {
EXPECT_EQ(
- "https://docs.google.com/feeds/default/private/full/XXX?v=3&alt=json",
+ "https://docs.google.com/feeds/default/private/full/XXX?v=3&alt=json"
+ "&showroot=true",
url_generator_.GenerateEditUrl("XXX").spec());
}
@@ -175,14 +179,14 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateEditUrlWithoutParams) {
TEST_F(GDataWapiUrlGeneratorTest, GenerateContentUrl) {
EXPECT_EQ(
"https://docs.google.com/feeds/default/private/full/"
- "folder%3Aroot/contents?v=3&alt=json",
+ "folder%3Aroot/contents?v=3&alt=json&showroot=true",
url_generator_.GenerateContentUrl("folder:root").spec());
}
TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceUrlForRemoval) {
EXPECT_EQ(
"https://docs.google.com/feeds/default/private/full/"
- "folder%3Aroot/contents/file%3AABCDE?v=3&alt=json",
+ "folder%3Aroot/contents/file%3AABCDE?v=3&alt=json&showroot=true",
url_generator_.GenerateResourceUrlForRemoval(
"folder:root", "file:ABCDE").spec());
}
@@ -190,21 +194,22 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceUrlForRemoval) {
TEST_F(GDataWapiUrlGeneratorTest, GenerateInitiateUploadNewFileUrl) {
EXPECT_EQ(
"https://docs.google.com/feeds/upload/create-session/default/private/"
- "full/folder%3Aabcde/contents?convert=false&v=3&alt=json",
+ "full/folder%3Aabcde/contents?convert=false&v=3&alt=json&showroot=true",
url_generator_.GenerateInitiateUploadNewFileUrl("folder:abcde").spec());
}
TEST_F(GDataWapiUrlGeneratorTest, GenerateInitiateUploadExistingFileUrl) {
EXPECT_EQ(
"https://docs.google.com/feeds/upload/create-session/default/private/"
- "full/file%3Aresource_id?convert=false&v=3&alt=json",
+ "full/file%3Aresource_id?convert=false&v=3&alt=json&showroot=true",
url_generator_.GenerateInitiateUploadExistingFileUrl(
"file:resource_id").spec());
}
TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListRootUrl) {
EXPECT_EQ(
- "https://docs.google.com/feeds/default/private/full?v=3&alt=json",
+ "https://docs.google.com/feeds/default/private/full?v=3&alt=json"
+ "&showroot=true",
url_generator_.GenerateResourceListRootUrl().spec());
}
@@ -212,12 +217,13 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateAccountMetadataUrl) {
// Include installed apps.
EXPECT_EQ(
"https://docs.google.com/feeds/metadata/default"
- "?v=3&alt=json&include-installed-apps=true",
+ "?v=3&alt=json&showroot=true&include-installed-apps=true",
url_generator_.GenerateAccountMetadataUrl(true).spec());
// Exclude installed apps.
EXPECT_EQ(
- "https://docs.google.com/feeds/metadata/default?v=3&alt=json",
+ "https://docs.google.com/feeds/metadata/default?v=3&alt=json"
+ "&showroot=true",
url_generator_.GenerateAccountMetadataUrl(false).spec());
}