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

Unified Diff: chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc

Issue 12585003: drive: Add showroot=true to WAPI feed URLs and ignore "no parent" entries. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix browser_tests. Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc
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 b81394c5986e73b374fb59a9ab6ad69ec40e5e4d..ba5f041032b0b574d96cd58e21f08fb9ca9f85ae 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());
}

Powered by Google App Engine
This is Rietveld 408576698