summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 14:46:45 +0000
committerhidehiko@chromium.org <hidehiko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-19 14:46:45 +0000
commit48b6601cb7a02a3cd6ff74c8f9d5f222ddc2304f (patch)
treec633a2f42e7bb230eaa23bf72fdcf3e29a1f63f5
parent4d82ea811913c9aac247082502b9ebf47fde3229 (diff)
downloadchromium_src-48b6601cb7a02a3cd6ff74c8f9d5f222ddc2304f.zip
chromium_src-48b6601cb7a02a3cd6ff74c8f9d5f222ddc2304f.tar.gz
chromium_src-48b6601cb7a02a3cd6ff74c8f9d5f222ddc2304f.tar.bz2
Small clean up of GDataWapiUrlGenerator.
Removed unnecessary query parameter "include-installed-apps=true" from AddFeedUrlParams. Use base::IntToString instead of StringPrintf for trivial case. This is a preparation to add new method into GDataWapiUrlGenerator to support "search by title exact match". BUG=232352 TEST=Ran unit_tests Review URL: https://chromiumcodereview.appspot.com/14240004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195191 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/google_apis/gdata_wapi_operations.cc2
-rw-r--r--chrome/browser/google_apis/gdata_wapi_operations.h4
-rw-r--r--chrome/browser/google_apis/gdata_wapi_operations_unittest.cc9
-rw-r--r--chrome/browser/google_apis/gdata_wapi_url_generator.cc16
-rw-r--r--chrome/browser/google_apis/gdata_wapi_url_generator.h4
-rw-r--r--chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc18
6 files changed, 21 insertions, 32 deletions
diff --git a/chrome/browser/google_apis/gdata_wapi_operations.cc b/chrome/browser/google_apis/gdata_wapi_operations.cc
index 0b78d67..009384d 100644
--- a/chrome/browser/google_apis/gdata_wapi_operations.cc
+++ b/chrome/browser/google_apis/gdata_wapi_operations.cc
@@ -163,7 +163,7 @@ GetResourceListOperation::GetResourceListOperation(
net::URLRequestContextGetter* url_request_context_getter,
const GDataWapiUrlGenerator& url_generator,
const GURL& override_url,
- int start_changestamp,
+ int64 start_changestamp,
const std::string& search_string,
const std::string& directory_resource_id,
const GetResourceListCallback& callback)
diff --git a/chrome/browser/google_apis/gdata_wapi_operations.h b/chrome/browser/google_apis/gdata_wapi_operations.h
index e167d79..10e0b0e 100644
--- a/chrome/browser/google_apis/gdata_wapi_operations.h
+++ b/chrome/browser/google_apis/gdata_wapi_operations.h
@@ -51,7 +51,7 @@ class GetResourceListOperation : public GetDataOperation {
net::URLRequestContextGetter* url_request_context_getter,
const GDataWapiUrlGenerator& url_generator,
const GURL& override_url,
- int start_changestamp,
+ int64 start_changestamp,
const std::string& search_string,
const std::string& directory_resource_id,
const GetResourceListCallback& callback);
@@ -64,7 +64,7 @@ class GetResourceListOperation : public GetDataOperation {
private:
const GDataWapiUrlGenerator url_generator_;
const GURL override_url_;
- const int start_changestamp_;
+ const int64 start_changestamp_;
const std::string search_string_;
const std::string directory_resource_id_;
diff --git a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
index 88f2027..587971a 100644
--- a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
@@ -339,8 +339,7 @@ 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?v=3&alt=json&showroot=true&"
- "showfolders=true&include-shared=true&max-results=500&"
- "include-installed-apps=true",
+ "showfolders=true&include-shared=true&max-results=500",
http_request_.relative_url);
// Sanity check of the result.
@@ -373,8 +372,7 @@ 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&showroot=true&"
- "showfolders=true&include-shared=true&max-results=500"
- "&include-installed-apps=true",
+ "showfolders=true&include-shared=true&max-results=500",
http_request_.relative_url);
scoped_ptr<ResourceList> expected(
@@ -408,8 +406,7 @@ 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&showroot=true&"
- "showfolders=true&include-shared=true&max-results=500&"
- "include-installed-apps=true",
+ "showfolders=true&include-shared=true&max-results=500",
http_request_.relative_url);
EXPECT_FALSE(result_data);
}
diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator.cc b/chrome/browser/google_apis/gdata_wapi_url_generator.cc
index bfd6ff4..7f916a9 100644
--- a/chrome/browser/google_apis/gdata_wapi_url_generator.cc
+++ b/chrome/browser/google_apis/gdata_wapi_url_generator.cc
@@ -6,6 +6,7 @@
#include "base/logging.h"
#include "base/stringprintf.h"
+#include "base/strings/string_number_conversions.h"
#include "googleurl/src/gurl.h"
#include "net/base/escape.h"
#include "net/base/url_util.h"
@@ -74,22 +75,17 @@ GURL GDataWapiUrlGenerator::AddInitiateUploadUrlParams(const GURL& url) {
GURL GDataWapiUrlGenerator::AddFeedUrlParams(
const GURL& url,
int num_items_to_fetch,
- int changestamp,
+ int64 changestamp,
const std::string& search_string) {
GURL result = AddStandardUrlParams(url);
result = net::AppendOrReplaceQueryParameter(result, "showfolders", "true");
result = net::AppendOrReplaceQueryParameter(result, "include-shared", "true");
result = net::AppendOrReplaceQueryParameter(
- result,
- "max-results",
- base::StringPrintf("%d", num_items_to_fetch));
- result = net::AppendOrReplaceQueryParameter(
- result, "include-installed-apps", "true");
+ result, "max-results", base::IntToString(num_items_to_fetch));
if (changestamp) {
- result = net::AppendQueryParameter(result,
- "start-index",
- base::StringPrintf("%d", changestamp));
+ result = net::AppendQueryParameter(
+ result, "start-index", base::Int64ToString(changestamp));
}
if (!search_string.empty()) {
@@ -107,7 +103,7 @@ GDataWapiUrlGenerator::~GDataWapiUrlGenerator() {
GURL GDataWapiUrlGenerator::GenerateResourceListUrl(
const GURL& override_url,
- int start_changestamp,
+ int64 start_changestamp,
const std::string& search_string,
const std::string& directory_resource_id) const {
DCHECK_LE(0, start_changestamp);
diff --git a/chrome/browser/google_apis/gdata_wapi_url_generator.h b/chrome/browser/google_apis/gdata_wapi_url_generator.h
index 16667da..f6099f1 100644
--- a/chrome/browser/google_apis/gdata_wapi_url_generator.h
+++ b/chrome/browser/google_apis/gdata_wapi_url_generator.h
@@ -37,7 +37,7 @@ class GDataWapiUrlGenerator {
// and adds q=... parameter if |search_string| is non-empty.
static GURL AddFeedUrlParams(const GURL& url,
int num_items_to_fetch,
- int changestamp,
+ int64 changestamp,
const std::string& search_string);
// Generates a URL for getting the resource list feed.
@@ -69,7 +69,7 @@ class GDataWapiUrlGenerator {
//
GURL GenerateResourceListUrl(
const GURL& override_url,
- int start_changestamp,
+ int64 start_changestamp,
const std::string& search_string,
const std::string& directory_resource_id) const;
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 de80699..9adec55 100644
--- a/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_url_generator_unittest.cc
@@ -36,8 +36,7 @@ TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) {
"http://www.example.com/?v=3&alt=json&showroot=true&"
"showfolders=true"
"&include-shared=true"
- "&max-results=100"
- "&include-installed-apps=true",
+ "&max-results=100",
GDataWapiUrlGenerator::AddFeedUrlParams(GURL("http://www.example.com"),
100, // num_items_to_fetch
0, // changestamp
@@ -48,7 +47,6 @@ TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) {
"showfolders=true"
"&include-shared=true"
"&max-results=100"
- "&include-installed-apps=true"
"&start-index=123",
GDataWapiUrlGenerator::AddFeedUrlParams(GURL("http://www.example.com"),
100, // num_items_to_fetch
@@ -59,7 +57,6 @@ TEST_F(GDataWapiUrlGeneratorTest, AddFeedUrlParams) {
"showfolders=true"
"&include-shared=true"
"&max-results=100"
- "&include-installed-apps=true"
"&start-index=123"
"&q=%22foo+bar%22",
GDataWapiUrlGenerator::AddFeedUrlParams(
@@ -74,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"
"?v=3&alt=json&showroot=true&showfolders=true&include-shared=true"
- "&max-results=500&include-installed-apps=true",
+ "&max-results=500",
url_generator_.GenerateResourceListUrl(
GURL(), // override_url,
0, // start_changestamp,
@@ -86,7 +83,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// parameters remain as-is.
EXPECT_EQ("http://localhost/"
"?v=3&alt=json&showroot=true&showfolders=true&include-shared=true"
- "&max-results=500&include-installed-apps=true",
+ "&max-results=500",
url_generator_.GenerateResourceListUrl(
GURL("http://localhost/"), // override_url,
0, // start_changestamp,
@@ -98,8 +95,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// "full" to "changes", and "start-index" parameter is added.
EXPECT_EQ("https://docs.google.com/feeds/default/private/changes"
"?v=3&alt=json&showroot=true&showfolders=true&include-shared=true"
- "&max-results=500&include-installed-apps=true"
- "&start-index=100",
+ "&max-results=500&start-index=100",
url_generator_.GenerateResourceListUrl(
GURL(), // override_url,
100, // start_changestamp,
@@ -111,7 +107,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// and "q" parameter is added.
EXPECT_EQ("https://docs.google.com/feeds/default/private/full"
"?v=3&alt=json&showroot=true&showfolders=true&include-shared=true"
- "&max-results=50&include-installed-apps=true&q=foo",
+ "&max-results=50&q=foo",
url_generator_.GenerateResourceListUrl(
GURL(), // override_url,
0, // start_changestamp,
@@ -124,7 +120,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
EXPECT_EQ(
"https://docs.google.com/feeds/default/private/full/XXX/contents"
"?v=3&alt=json&showroot=true&showfolders=true&include-shared=true"
- "&max-results=500&include-installed-apps=true",
+ "&max-results=500",
url_generator_.GenerateResourceListUrl(GURL(), // override_url,
0, // start_changestamp,
std::string(), // search_string,
@@ -136,7 +132,7 @@ TEST_F(GDataWapiUrlGeneratorTest, GenerateResourceListUrl) {
// overridden.
EXPECT_EQ("http://example.com/"
"?start-index=123&v=3&alt=json&showroot=true&showfolders=true"
- "&include-shared=true&max-results=500&include-installed-apps=true",
+ "&include-shared=true&max-results=500",
url_generator_.GenerateResourceListUrl(
GURL("http://example.com/?start-index=123"), // override_url,
100, // start_changestamp,