diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-25 05:59:39 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-25 05:59:39 +0000 |
commit | cf32b6c125778c8c116a51bc4035e39a85627aa0 (patch) | |
tree | 5fa2e565aecded28f40061dffe09cf388fd855a0 | |
parent | fdcec9b04700b9d7ac8dd1fb62f5fcf5b67c1643 (diff) | |
download | chromium_src-cf32b6c125778c8c116a51bc4035e39a85627aa0.zip chromium_src-cf32b6c125778c8c116a51bc4035e39a85627aa0.tar.gz chromium_src-cf32b6c125778c8c116a51bc4035e39a85627aa0.tar.bz2 |
google_apis: Remove use of 'feed' from where inappropriate
WAPI (Documents List API) is based on ATOM hence the term "feed" is
appropriate but "feed" is not appropriate for Drive API.
gdata_* files are untouhced as "feed" is appropriate in these files.
BUG=165395
TEST=none. Just renames and fixes in comments
Review URL: https://codereview.chromium.org/13057002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190344 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/google_apis/base_operations.h | 6 | ||||
-rw-r--r-- | chrome/browser/google_apis/drive_api_operations.h | 2 | ||||
-rw-r--r-- | chrome/browser/google_apis/drive_api_operations_unittest.cc | 40 | ||||
-rw-r--r-- | chrome/browser/google_apis/drive_api_service.h | 4 | ||||
-rw-r--r-- | chrome/browser/google_apis/drive_service_interface.h | 13 | ||||
-rw-r--r-- | chrome/browser/google_apis/dummy_drive_service.cc | 2 | ||||
-rw-r--r-- | chrome/browser/google_apis/dummy_drive_service.h | 2 | ||||
-rw-r--r-- | chrome/browser/google_apis/fake_drive_service.cc | 4 | ||||
-rw-r--r-- | chrome/browser/google_apis/fake_drive_service.h | 2 | ||||
-rw-r--r-- | chrome/browser/google_apis/mock_drive_service.cc | 13 | ||||
-rw-r--r-- | chrome/browser/google_apis/mock_drive_service.h | 20 |
11 files changed, 55 insertions, 53 deletions
diff --git a/chrome/browser/google_apis/base_operations.h b/chrome/browser/google_apis/base_operations.h index a630d52..fc1f8b5 100644 --- a/chrome/browser/google_apis/base_operations.h +++ b/chrome/browser/google_apis/base_operations.h @@ -215,10 +215,10 @@ class EntryActionOperation : public UrlFetchOperationBase { //============================== GetDataOperation ============================== // Callback type for DocumentServiceInterface::GetResourceList. -// Note: feed_data argument should be passed using base::Passed(&feed_data), not -// feed_data.Pass(). +// Note: json_data argument should be passed using base::Passed(&json_data), not +// json_data.Pass(). typedef base::Callback<void(GDataErrorCode error, - scoped_ptr<base::Value> feed_data)> GetDataCallback; + scoped_ptr<base::Value> json_data)> GetDataCallback; // This class performs the operation for fetching and converting the fetched // content into a base::Value. diff --git a/chrome/browser/google_apis/drive_api_operations.h b/chrome/browser/google_apis/drive_api_operations.h index 675976c..c90bd06 100644 --- a/chrome/browser/google_apis/drive_api_operations.h +++ b/chrome/browser/google_apis/drive_api_operations.h @@ -76,7 +76,7 @@ class GetChangelistOperation : public GetDataOperation { public: // |start_changestamp| specifies the starting point of change list or 0 if // all changes are necessary. - // |url| specifies URL for document feed fetching operation. If empty URL is + // |url| specifies URL for change list fetching operation. If empty URL is // passed, the default URL is used and returns the first page of the result. // When non-first page result is requested, |url| should be specified. GetChangelistOperation( diff --git a/chrome/browser/google_apis/drive_api_operations_unittest.cc b/chrome/browser/google_apis/drive_api_operations_unittest.cc index 29092d00..36c2c89 100644 --- a/chrome/browser/google_apis/drive_api_operations_unittest.cc +++ b/chrome/browser/google_apis/drive_api_operations_unittest.cc @@ -298,13 +298,13 @@ class DriveApiOperationsTest : public testing::Test { int64 content_length_; }; -TEST_F(DriveApiOperationsTest, GetAboutOperation_ValidFeed) { +TEST_F(DriveApiOperationsTest, GetAboutOperation_ValidJson) { // Set an expected data file containing valid result. expected_data_file_path_ = test_util::GetTestFilePath( "chromeos/drive/about.json"); GDataErrorCode error = GDATA_OTHER_ERROR; - scoped_ptr<AboutResource> feed_data; + scoped_ptr<AboutResource> about_resource; GetAboutOperation* operation = new GetAboutOperation( &operation_registry_, @@ -312,7 +312,7 @@ TEST_F(DriveApiOperationsTest, GetAboutOperation_ValidFeed) { *url_generator_, CreateComposedCallback( base::Bind(&test_util::RunAndQuit), - test_util::CreateCopyResultCallback(&error, &feed_data))); + test_util::CreateCopyResultCallback(&error, &about_resource))); operation->Start(kTestDriveApiAuthToken, kTestUserAgent, base::Bind(&test_util::DoNothingForReAuthenticateCallback)); MessageLoop::current()->Run(); @@ -324,20 +324,20 @@ TEST_F(DriveApiOperationsTest, GetAboutOperation_ValidFeed) { scoped_ptr<AboutResource> expected( AboutResource::CreateFrom( *test_util::LoadJSONFile("chromeos/drive/about.json"))); - ASSERT_TRUE(feed_data.get()); - EXPECT_EQ(expected->largest_change_id(), feed_data->largest_change_id()); - EXPECT_EQ(expected->quota_bytes_total(), feed_data->quota_bytes_total()); - EXPECT_EQ(expected->quota_bytes_used(), feed_data->quota_bytes_used()); - EXPECT_EQ(expected->root_folder_id(), feed_data->root_folder_id()); + ASSERT_TRUE(about_resource.get()); + EXPECT_EQ(expected->largest_change_id(), about_resource->largest_change_id()); + EXPECT_EQ(expected->quota_bytes_total(), about_resource->quota_bytes_total()); + EXPECT_EQ(expected->quota_bytes_used(), about_resource->quota_bytes_used()); + EXPECT_EQ(expected->root_folder_id(), about_resource->root_folder_id()); } -TEST_F(DriveApiOperationsTest, GetAboutOperation_InvalidFeed) { +TEST_F(DriveApiOperationsTest, GetAboutOperation_InvalidJson) { // Set an expected data file containing invalid result. expected_data_file_path_ = test_util::GetTestFilePath( "chromeos/gdata/testfile.txt"); GDataErrorCode error = GDATA_OTHER_ERROR; - scoped_ptr<AboutResource> feed_data; + scoped_ptr<AboutResource> about_resource; GetAboutOperation* operation = new GetAboutOperation( &operation_registry_, @@ -345,16 +345,16 @@ TEST_F(DriveApiOperationsTest, GetAboutOperation_InvalidFeed) { *url_generator_, CreateComposedCallback( base::Bind(&test_util::RunAndQuit), - test_util::CreateCopyResultCallback(&error, &feed_data))); + test_util::CreateCopyResultCallback(&error, &about_resource))); operation->Start(kTestDriveApiAuthToken, kTestUserAgent, base::Bind(&test_util::DoNothingForReAuthenticateCallback)); MessageLoop::current()->Run(); - // "parse error" should be returned, and the feed should be NULL. + // "parse error" should be returned, and the about resource should be NULL. EXPECT_EQ(GDATA_PARSE_ERROR, error); EXPECT_EQ(test_server::METHOD_GET, http_request_.method); EXPECT_EQ("/drive/v2/about", http_request_.relative_url); - EXPECT_FALSE(feed_data.get()); + EXPECT_FALSE(about_resource.get()); } TEST_F(DriveApiOperationsTest, CreateDirectoryOperation) { @@ -363,7 +363,7 @@ TEST_F(DriveApiOperationsTest, CreateDirectoryOperation) { test_util::GetTestFilePath("chromeos/drive/directory_entry.json"); GDataErrorCode error = GDATA_OTHER_ERROR; - scoped_ptr<FileResource> feed_data; + scoped_ptr<FileResource> file_resource; // Create "new directory" in the root directory. drive::CreateDirectoryOperation* operation = @@ -375,7 +375,7 @@ TEST_F(DriveApiOperationsTest, CreateDirectoryOperation) { "new directory", CreateComposedCallback( base::Bind(&test_util::RunAndQuit), - test_util::CreateCopyResultCallback(&error, &feed_data))); + test_util::CreateCopyResultCallback(&error, &file_resource))); operation->Start(kTestDriveApiAuthToken, kTestUserAgent, base::Bind(&test_util::DoNothingForReAuthenticateCallback)); MessageLoop::current()->Run(); @@ -392,12 +392,12 @@ TEST_F(DriveApiOperationsTest, CreateDirectoryOperation) { *test_util::LoadJSONFile("chromeos/drive/directory_entry.json"))); // Sanity check. - ASSERT_TRUE(feed_data.get()); + ASSERT_TRUE(file_resource.get()); - EXPECT_EQ(expected->file_id(), feed_data->file_id()); - EXPECT_EQ(expected->title(), feed_data->title()); - EXPECT_EQ(expected->mime_type(), feed_data->mime_type()); - EXPECT_EQ(expected->parents().size(), feed_data->parents().size()); + EXPECT_EQ(expected->file_id(), file_resource->file_id()); + EXPECT_EQ(expected->title(), file_resource->title()); + EXPECT_EQ(expected->mime_type(), file_resource->mime_type()); + EXPECT_EQ(expected->parents().size(), file_resource->parents().size()); } TEST_F(DriveApiOperationsTest, RenameResourceOperation) { diff --git a/chrome/browser/google_apis/drive_api_service.h b/chrome/browser/google_apis/drive_api_service.h index 75db0ab..d209efd 100644 --- a/chrome/browser/google_apis/drive_api_service.h +++ b/chrome/browser/google_apis/drive_api_service.h @@ -27,7 +27,7 @@ class URLRequestContextGetter; namespace google_apis { class OperationRunner; -// This class provides documents feed service calls for Drive V2 API. +// This class provides Drive operation calls using Drive V2 API. // Details of API call are abstracted in each operation class and this class // works as a thin wrapper for the API. class DriveAPIService : public DriveServiceInterface, @@ -61,7 +61,7 @@ class DriveAPIService : public DriveServiceInterface, virtual void ClearRefreshToken() OVERRIDE; virtual std::string GetRootResourceId() const OVERRIDE; virtual void GetResourceList( - const GURL& feed_url, + const GURL& url, int64 start_changestamp, const std::string& search_query, bool shared_with_me, diff --git a/chrome/browser/google_apis/drive_service_interface.h b/chrome/browser/google_apis/drive_service_interface.h index 3eca1d4..bbc6da9 100644 --- a/chrome/browser/google_apis/drive_service_interface.h +++ b/chrome/browser/google_apis/drive_service_interface.h @@ -131,11 +131,12 @@ class DriveServiceInterface { // Returns the resource id for the root directory. virtual std::string GetRootResourceId() const = 0; - // Fetches a feed from |feed_url|. If this URL is empty, the call will fetch - // from the default URL. When |start_changestamp| is 0, the default behavior - // is to fetch the resource list feed containing the list of all entries. If - // |start_changestamp| > 0, the default is to fetch the change list feed - // containing the updates from the specified changestamp. + // Fetches a resource list or a change list from |url|. If this URL is + // empty, the call will fetch from the default URL. When + // |start_changestamp| is 0, the default behavior is to fetch the resource + // list containing the list of all entries. If |start_changestamp| > 0, the + // default is to fetch the change list containing the updates from the + // specified changestamp. // // |search_query| specifies search query to be sent to the server. It will be // used only if |start_changestamp| is 0. If empty string is passed, @@ -148,7 +149,7 @@ class DriveServiceInterface { // Upon completion, invokes |callback| with results on the calling thread. // TODO(haruki): Refactor this function: crbug.com/160932 // |callback| must not be null. - virtual void GetResourceList(const GURL& feed_url, + virtual void GetResourceList(const GURL& url, int64 start_changestamp, const std::string& search_query, bool shared_with_me, diff --git a/chrome/browser/google_apis/dummy_drive_service.cc b/chrome/browser/google_apis/dummy_drive_service.cc index 6bf80ac..cb58165 100644 --- a/chrome/browser/google_apis/dummy_drive_service.cc +++ b/chrome/browser/google_apis/dummy_drive_service.cc @@ -41,7 +41,7 @@ std::string DummyDriveService::GetRootResourceId() const { } void DummyDriveService::GetResourceList( - const GURL& feed_url, + const GURL& url, int64 start_changestamp, const std::string& search_query, bool shared_with_me, diff --git a/chrome/browser/google_apis/dummy_drive_service.h b/chrome/browser/google_apis/dummy_drive_service.h index 52c8c14..c75d18f 100644 --- a/chrome/browser/google_apis/dummy_drive_service.h +++ b/chrome/browser/google_apis/dummy_drive_service.h @@ -30,7 +30,7 @@ class DummyDriveService : public DriveServiceInterface { virtual void ClearRefreshToken() OVERRIDE; virtual std::string GetRootResourceId() const OVERRIDE; virtual void GetResourceList( - const GURL& feed_url, + const GURL& url, int64 start_changestamp, const std::string& search_query, bool shared_with_me, diff --git a/chrome/browser/google_apis/fake_drive_service.cc b/chrome/browser/google_apis/fake_drive_service.cc index 94b2db3..ee02177 100644 --- a/chrome/browser/google_apis/fake_drive_service.cc +++ b/chrome/browser/google_apis/fake_drive_service.cc @@ -197,7 +197,7 @@ std::string FakeDriveService::GetRootResourceId() const { } void FakeDriveService::GetResourceList( - const GURL& feed_url, + const GURL& url, int64 start_changestamp, const std::string& search_query, bool shared_with_me, @@ -222,7 +222,7 @@ void FakeDriveService::GetResourceList( int max_results = default_max_results_; std::vector<std::pair<std::string, std::string> > parameters; if (base::SplitStringIntoKeyValuePairs( - feed_url.query(), '=', '&', ¶meters)) { + url.query(), '=', '&', ¶meters)) { for (size_t i = 0; i < parameters.size(); ++i) { if (parameters[i].first == "start-offset") base::StringToInt(parameters[i].second, &start_offset); diff --git a/chrome/browser/google_apis/fake_drive_service.h b/chrome/browser/google_apis/fake_drive_service.h index 8130673..17f5166 100644 --- a/chrome/browser/google_apis/fake_drive_service.h +++ b/chrome/browser/google_apis/fake_drive_service.h @@ -90,7 +90,7 @@ class FakeDriveService : public DriveServiceInterface { // See the comment for EntryMatchWidthQuery() in .cc file for details about // the supported search query types. virtual void GetResourceList( - const GURL& feed_url, + const GURL& url, int64 start_changestamp, const std::string& search_query, bool shared_with_me, diff --git a/chrome/browser/google_apis/mock_drive_service.cc b/chrome/browser/google_apis/mock_drive_service.cc index d2323ec..9e65450 100644 --- a/chrome/browser/google_apis/mock_drive_service.cc +++ b/chrome/browser/google_apis/mock_drive_service.cc @@ -46,10 +46,11 @@ MockDriveService::MockDriveService() { ON_CALL(*this, DownloadFile(_, _, _, _, _)) .WillByDefault(Invoke(this, &MockDriveService::DownloadFileStub)); - // Fill in the default values for mock feeds. + // Fill in the default values for mock data. account_metadata_data_ = test_util::LoadJSONFile("chromeos/gdata/account_metadata.json"); - feed_data_ = test_util::LoadJSONFile("chromeos/gdata/basic_feed.json"); + resource_list_data_ = + test_util::LoadJSONFile("chromeos/gdata/basic_feed.json"); directory_data_ = test_util::LoadJSONFile("chromeos/gdata/new_folder_entry.json"); } @@ -57,12 +58,12 @@ MockDriveService::MockDriveService() { MockDriveService::~MockDriveService() {} void MockDriveService::set_search_result( - const std::string& search_result_feed) { - search_result_ = test_util::LoadJSONFile(search_result_feed); + const std::string& search_result_file) { + search_result_ = test_util::LoadJSONFile(search_result_file); } void MockDriveService::GetResourceListStub( - const GURL& feed_url, + const GURL& url, int64 start_changestamp, const std::string& search_string, bool shared_with_me, @@ -70,7 +71,7 @@ void MockDriveService::GetResourceListStub( const GetResourceListCallback& callback) { if (search_string.empty()) { scoped_ptr<ResourceList> resource_list = - ResourceList::ExtractAndParse(*feed_data_); + ResourceList::ExtractAndParse(*resource_list_data_); base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(callback, HTTP_SUCCESS, diff --git a/chrome/browser/google_apis/mock_drive_service.h b/chrome/browser/google_apis/mock_drive_service.h index 45c7a53..3680315 100644 --- a/chrome/browser/google_apis/mock_drive_service.h +++ b/chrome/browser/google_apis/mock_drive_service.h @@ -38,7 +38,7 @@ class MockDriveService : public DriveServiceInterface { OperationProgressStatusList()); MOCK_CONST_METHOD0(GetRootResourceId, std::string()); MOCK_METHOD6(GetResourceList, - void(const GURL& feed_url, + void(const GURL& url, int64 start_changestamp, const std::string& search_string, bool shared_with_me, @@ -126,15 +126,15 @@ class MockDriveService : public DriveServiceInterface { file_data_.reset(file_data); } - void set_search_result(const std::string& search_result_feed); + void set_search_result(const std::string& search_result_file); private: // Helper stub methods for functions which take callbacks, so that // the callbacks get called with testable results. // Will call |callback| with HTTP_SUCCESS and a StringValue with the current - // value of |feed_data_|. - void GetResourceListStub(const GURL& feed_url, + // value of |resource_list_data_|. + void GetResourceListStub(const GURL& url, int64 start_changestamp, const std::string& search_string, bool shared_with_me, @@ -192,17 +192,17 @@ class MockDriveService : public DriveServiceInterface { // Account meta data to be returned from GetAccountMetadata. scoped_ptr<base::Value> account_metadata_data_; - // Feed data to be returned from GetResourceList. - scoped_ptr<base::Value> feed_data_; + // JSON data to be returned from GetResourceList. + scoped_ptr<base::Value> resource_list_data_; - // Feed data to be returned from CreateDirectory. + // JSON data to be returned from CreateDirectory. scoped_ptr<base::Value> directory_data_; - // Feed data to be returned from CopyHostedDocument. + // JSON data to be returned from CopyHostedDocument. scoped_ptr<base::Value> document_data_; - // Feed data to be returned from GetResourceList if the search path is - // specified. The feed contains subset of the root_feed. + // JSON data to be returned from GetResourceList if the search path is + // specified. The value contains subset of the resource_list_data_. scoped_ptr<base::Value> search_result_; // File data to be written to the local temporary file when |