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

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

Issue 12088104: Move DownloadFileOperation to base_operations. (Closed) Base URL: http://git.chromium.org/chromium/src.git@b148627_download_file_3_test_util
Patch Set: Rebase Created 7 years, 10 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
« no previous file with comments | « chrome/browser/google_apis/gdata_wapi_operations.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
diff --git a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
index 73bbf9cbfe6c4e47664f192b512339e5306b70e9..e9dc6b3d119e6d12e5d35c65787b3f7bd3a51644 100644
--- a/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
+++ b/chrome/browser/google_apis/gdata_wapi_operations_unittest.cc
@@ -35,20 +35,6 @@ const char kTestGDataAuthToken[] = "testtoken";
const char kTestUserAgent[] = "test-user-agent";
const char kTestETag[] = "test_etag";
-// Copies the results from DownloadActionCallback and quit the message loop.
-// The contents of the download cache file are copied to a string, and the
-// file is removed.
-void CopyResultsFromDownloadActionCallbackAndQuit(
- GDataErrorCode* out_result_code,
- std::string* contents,
- GDataErrorCode result_code,
- const FilePath& cache_file_path) {
- *out_result_code = result_code;
- file_util::ReadFileToString(cache_file_path, contents);
- file_util::Delete(cache_file_path, false);
- MessageLoop::current()->Quit();
-}
-
// Copies the result from InitiateUploadCallback and quit the message loop.
void CopyResultFromInitiateUploadCallbackAndQuit(
GDataErrorCode* out_result_code,
@@ -149,11 +135,6 @@ class GDataWapiOperationsTest : public testing::Test {
}
protected:
- // Returns a temporary file path suitable for storing the cache file.
- FilePath GetTestCachedFilePath(const FilePath& file_name) {
- return profile_->GetPath().Append(file_name);
- }
-
// Handles a request for fetching a resource feed.
scoped_ptr<test_server::HttpResponse> HandleResourceFeedRequest(
const test_server::HttpRequest& request) {
@@ -505,60 +486,6 @@ TEST_F(GDataWapiOperationsTest, GetAccountMetadataOperation) {
result_data.get()));
}
-TEST_F(GDataWapiOperationsTest, DownloadFileOperation_ValidFile) {
- GDataErrorCode result_code = GDATA_OTHER_ERROR;
- std::string contents;
- DownloadFileOperation* operation = new DownloadFileOperation(
- &operation_registry_,
- request_context_getter_.get(),
- base::Bind(&CopyResultsFromDownloadActionCallbackAndQuit,
- &result_code,
- &contents),
- GetContentCallback(),
- test_server_.GetURL("/files/gdata/testfile.txt"),
- FilePath::FromUTF8Unsafe("/dummy/gdata/testfile.txt"),
- GetTestCachedFilePath(FilePath::FromUTF8Unsafe("cached_testfile.txt")));
- operation->Start(kTestGDataAuthToken, kTestUserAgent,
- base::Bind(&test_util::DoNothingForReAuthenticateCallback));
- MessageLoop::current()->Run();
-
- EXPECT_EQ(HTTP_SUCCESS, result_code);
- EXPECT_EQ(test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ("/files/gdata/testfile.txt", http_request_.relative_url);
-
- const FilePath expected_path =
- test_util::GetTestFilePath("gdata/testfile.txt");
- std::string expected_contents;
- file_util::ReadFileToString(expected_path, &expected_contents);
- EXPECT_EQ(expected_contents, contents);
-}
-
-// http://crbug.com/169588
-TEST_F(GDataWapiOperationsTest,
- DISABLED_DownloadFileOperation_NonExistentFile) {
- GDataErrorCode result_code = GDATA_OTHER_ERROR;
- std::string contents;
- DownloadFileOperation* operation = new DownloadFileOperation(
- &operation_registry_,
- request_context_getter_.get(),
- base::Bind(&CopyResultsFromDownloadActionCallbackAndQuit,
- &result_code,
- &contents),
- GetContentCallback(),
- test_server_.GetURL("/files/gdata/no-such-file.txt"),
- FilePath::FromUTF8Unsafe("/dummy/gdata/no-such-file.txt"),
- GetTestCachedFilePath(
- FilePath::FromUTF8Unsafe("cache_no-such-file.txt")));
- operation->Start(kTestGDataAuthToken, kTestUserAgent,
- base::Bind(&test_util::DoNothingForReAuthenticateCallback));
- MessageLoop::current()->Run();
-
- EXPECT_EQ(HTTP_NOT_FOUND, result_code);
- EXPECT_EQ(test_server::METHOD_GET, http_request_.method);
- EXPECT_EQ("/files/gdata/no-such-file.txt", http_request_.relative_url);
- // Do not verify the not found message.
-}
-
TEST_F(GDataWapiOperationsTest, DeleteResourceOperation) {
GDataErrorCode result_code = GDATA_OTHER_ERROR;
« no previous file with comments | « chrome/browser/google_apis/gdata_wapi_operations.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698