summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-19 22:54:33 +0000
committerkinaba@chromium.org <kinaba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-19 22:54:33 +0000
commitea272c283a29692e499ed3d81981eef971b3e435 (patch)
tree49547c3c0e882dd387ea317ba554b6684e43570c
parent9c1815a92d9fed410845478fd4fe8e19ca2db253 (diff)
downloadchromium_src-ea272c283a29692e499ed3d81981eef971b3e435.zip
chromium_src-ea272c283a29692e499ed3d81981eef971b3e435.tar.gz
chromium_src-ea272c283a29692e499ed3d81981eef971b3e435.tar.bz2
Random clean up on Drive related code.
BUG=none Review URL: https://codereview.chromium.org/28023002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@229638 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/chromeos/drive/async_file_util.cc4
-rw-r--r--chrome/browser/chromeos/drive/file_system.cc1
-rw-r--r--chrome/browser/drive/drive_uploader.cc8
-rw-r--r--chrome/browser/drive/fake_drive_service_unittest.cc4
-rw-r--r--chrome/browser/google_apis/auth_service.cc1
-rw-r--r--chrome/browser/google_apis/gdata_wapi_requests.cc16
-rw-r--r--chrome/browser/google_apis/gdata_wapi_requests_unittest.cc8
-rw-r--r--chrome/browser/google_apis/request_sender.h1
-rw-r--r--chrome/browser/google_apis/test_util.cc24
-rw-r--r--chrome/browser/google_apis/test_util.h8
10 files changed, 9 insertions, 66 deletions
diff --git a/chrome/browser/chromeos/drive/async_file_util.cc b/chrome/browser/chromeos/drive/async_file_util.cc
index bcd4161..4e9a03a 100644
--- a/chrome/browser/chromeos/drive/async_file_util.cc
+++ b/chrome/browser/chromeos/drive/async_file_util.cc
@@ -282,8 +282,6 @@ void AsyncFileUtil::CopyFileLocal(
const StatusCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- // TODO(hidehiko): Support option.
-
base::FilePath src_path = util::ExtractDrivePathFromFileSystemUrl(src_url);
base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url);
if (src_path.empty() || dest_path.empty()) {
@@ -309,8 +307,6 @@ void AsyncFileUtil::MoveFileLocal(
const StatusCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
- // TODO(hidehiko): Support option.
-
base::FilePath src_path = util::ExtractDrivePathFromFileSystemUrl(src_url);
base::FilePath dest_path = util::ExtractDrivePathFromFileSystemUrl(dest_url);
if (src_path.empty() || dest_path.empty()) {
diff --git a/chrome/browser/chromeos/drive/file_system.cc b/chrome/browser/chromeos/drive/file_system.cc
index 0162221..70941a5 100644
--- a/chrome/browser/chromeos/drive/file_system.cc
+++ b/chrome/browser/chromeos/drive/file_system.cc
@@ -8,7 +8,6 @@
#include "base/file_util.h"
#include "base/platform_file.h"
#include "base/prefs/pref_service.h"
-#include "base/threading/sequenced_worker_pool.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/chromeos/drive/change_list_loader.h"
#include "chrome/browser/chromeos/drive/change_list_processor.h"
diff --git a/chrome/browser/drive/drive_uploader.cc b/chrome/browser/drive/drive_uploader.cc
index 43d434f..30ab0b9c 100644
--- a/chrome/browser/drive/drive_uploader.cc
+++ b/chrome/browser/drive/drive_uploader.cc
@@ -287,12 +287,8 @@ void DriveUploader::OnUploadLocationReceived(
<< "] for [" << upload_file_info->file_path.value() << "]";
if (code != HTTP_SUCCESS) {
- // TODO(achuith): Handle error codes from Google Docs server.
- if (code == HTTP_PRECONDITION) {
- // ETag mismatch.
- UploadFailed(upload_file_info.Pass(), HTTP_CONFLICT);
- return;
- }
+ if (code == HTTP_PRECONDITION)
+ code = HTTP_CONFLICT; // ETag mismatch.
UploadFailed(upload_file_info.Pass(), code);
return;
}
diff --git a/chrome/browser/drive/fake_drive_service_unittest.cc b/chrome/browser/drive/fake_drive_service_unittest.cc
index 453a914..128fdf7 100644
--- a/chrome/browser/drive/fake_drive_service_unittest.cc
+++ b/chrome/browser/drive/fake_drive_service_unittest.cc
@@ -104,10 +104,6 @@ class FakeDriveServiceTest : public testing::Test {
FakeDriveService fake_service_;
};
-void AppendProgressCallbackResult(std::vector<int64>* values, int64 progress) {
- values->push_back(progress);
-}
-
TEST_F(FakeDriveServiceTest, GetAllResourceList) {
ASSERT_TRUE(fake_service_.LoadResourceListForWapi(
"gdata/root_feed.json"));
diff --git a/chrome/browser/google_apis/auth_service.cc b/chrome/browser/google_apis/auth_service.cc
index bd9a6b6..e9dca03 100644
--- a/chrome/browser/google_apis/auth_service.cc
+++ b/chrome/browser/google_apis/auth_service.cc
@@ -208,7 +208,6 @@ void AuthService::OnAuthCompleted(const AuthStatusCallback& callback,
ClearRefreshToken();
}
- // TODO(zelidrag): Add retry, back-off logic when things go wrong here.
callback.Run(error, access_token);
}
diff --git a/chrome/browser/google_apis/gdata_wapi_requests.cc b/chrome/browser/google_apis/gdata_wapi_requests.cc
index 1f99108..0857a42 100644
--- a/chrome/browser/google_apis/gdata_wapi_requests.cc
+++ b/chrome/browser/google_apis/gdata_wapi_requests.cc
@@ -5,17 +5,12 @@
#include "chrome/browser/google_apis/gdata_wapi_requests.h"
#include "base/location.h"
-#include "base/strings/string_number_conversions.h"
-#include "base/strings/stringprintf.h"
#include "base/task_runner_util.h"
#include "base/values.h"
#include "chrome/browser/google_apis/gdata_wapi_parser.h"
#include "chrome/browser/google_apis/gdata_wapi_url_generator.h"
#include "chrome/browser/google_apis/request_sender.h"
#include "chrome/browser/google_apis/request_util.h"
-#include "chrome/browser/google_apis/time_util.h"
-#include "net/base/escape.h"
-#include "net/base/url_util.h"
#include "third_party/libxml/chromium/libxml_utils.h"
using net::URLFetcher;
@@ -565,10 +560,7 @@ InitiateUploadNewFileRequest::InitiateUploadNewFileRequest(
int64 content_length,
const std::string& parent_resource_id,
const std::string& title)
- : InitiateUploadRequestBase(sender,
- callback,
- content_type,
- content_length),
+ : InitiateUploadRequestBase(sender, callback, content_type, content_length),
url_generator_(url_generator),
parent_resource_id_(parent_resource_id),
title_(title) {
@@ -614,10 +606,7 @@ InitiateUploadExistingFileRequest::InitiateUploadExistingFileRequest(
int64 content_length,
const std::string& resource_id,
const std::string& etag)
- : InitiateUploadRequestBase(sender,
- callback,
- content_type,
- content_length),
+ : InitiateUploadRequestBase(sender, callback, content_type, content_length),
url_generator_(url_generator),
resource_id_(resource_id),
etag_(etag) {
@@ -710,7 +699,6 @@ void GetUploadStatusRequest::OnRangeRequestComplete(
callback_.Run(response, ParseResourceEntry(value.Pass()));
}
-
//========================== DownloadFileRequest ==========================
DownloadFileRequest::DownloadFileRequest(
diff --git a/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc b/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc
index 08ca8e7..399925b 100644
--- a/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_requests_unittest.cc
@@ -494,9 +494,11 @@ TEST_F(GDataWapiRequestsTest, GetResourceEntryRequest_ValidResourceId) {
EXPECT_EQ("/feeds/default/private/full/file%3A2_file_resource_id"
"?v=3&alt=json&showroot=true",
http_request_.relative_url);
- EXPECT_TRUE(test_util::VerifyJsonData(
- test_util::GetTestFilePath("gdata/file_entry.json"),
- result_data.get()));
+ scoped_ptr<base::Value> expected_json =
+ test_util::LoadJSONFile("gdata/file_entry.json");
+ ASSERT_TRUE(expected_json);
+ EXPECT_TRUE(result_data);
+ EXPECT_TRUE(base::Value::Equals(expected_json.get(), result_data.get()));
}
TEST_F(GDataWapiRequestsTest, GetResourceEntryRequest_InvalidResourceId) {
diff --git a/chrome/browser/google_apis/request_sender.h b/chrome/browser/google_apis/request_sender.h
index 550a696..f37754c 100644
--- a/chrome/browser/google_apis/request_sender.h
+++ b/chrome/browser/google_apis/request_sender.h
@@ -7,7 +7,6 @@
#include <set>
#include <string>
-#include <vector>
#include "base/basictypes.h"
#include "base/callback_forward.h"
diff --git a/chrome/browser/google_apis/test_util.cc b/chrome/browser/google_apis/test_util.cc
index 934042e..e1d18fc 100644
--- a/chrome/browser/google_apis/test_util.cc
+++ b/chrome/browser/google_apis/test_util.cc
@@ -122,30 +122,6 @@ scoped_ptr<net::test_server::HttpResponse> HandleDownloadFileRequest(
GetTestFilePath(remaining_path)).PassAs<net::test_server::HttpResponse>();
}
-bool VerifyJsonData(const base::FilePath& expected_json_file_path,
- const base::Value* json_data) {
- if (!json_data) {
- LOG(ERROR) << "json_data is NULL";
- return false;
- }
-
- std::string expected_content;
- if (!base::ReadFileToString(expected_json_file_path, &expected_content)) {
- LOG(ERROR) << "Failed to read file: " << expected_json_file_path.value();
- return false;
- }
-
- scoped_ptr<base::Value> expected_json_data(
- base::JSONReader::Read(expected_content));
- if (!base::Value::Equals(expected_json_data.get(), json_data)) {
- LOG(ERROR)
- << "The value of json_data is different from the file's content.";
- return false;
- }
-
- return true;
-}
-
bool ParseContentRangeHeader(const std::string& value,
int64* start_position,
int64* end_position,
diff --git a/chrome/browser/google_apis/test_util.h b/chrome/browser/google_apis/test_util.h
index 42facc4..2976937 100644
--- a/chrome/browser/google_apis/test_util.h
+++ b/chrome/browser/google_apis/test_util.h
@@ -93,12 +93,6 @@ scoped_ptr<net::test_server::HttpResponse> HandleDownloadFileRequest(
net::test_server::HttpRequest* out_request,
const net::test_server::HttpRequest& request);
-// Returns true if |json_data| is not NULL and equals to the content in
-// |expected_json_file_path|. The failure reason will be logged into LOG(ERROR)
-// if necessary.
-bool VerifyJsonData(const base::FilePath& expected_json_file_path,
- const base::Value* json_data);
-
// Parses a value of Content-Range header, which looks like
// "bytes <start_position>-<end_position>/<length>".
// Returns true on success.
@@ -129,8 +123,6 @@ bool ParseContentRangeHeader(const std::string& value,
// :
//
// Note: The max arity of the supported function is 4 based on the usage.
-// TODO(hidehiko): Use replace CopyResultFromXxxCallback method defined above
-// by this one. (crbug.com/180569).
namespace internal {
// Following helper templates are to support Chrome's move semantics.
// Their goal is defining helper methods which are similar to: