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

Side by Side Diff: chrome/browser/google_apis/gdata_wapi_service_browsertest.cc

Issue 11143014: Add request header on gdata operation for testing ETag match. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix & test fix Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_path.h" 7 #include "base/file_path.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "chrome/browser/google_apis/auth_service.h" 10 #include "chrome/browser/google_apis/auth_service.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 } // namespace 75 } // namespace
76 76
77 IN_PROC_BROWSER_TEST_F(GDataTest, Download) { 77 IN_PROC_BROWSER_TEST_F(GDataTest, Download) {
78 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; 78 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR;
79 std::string contents; 79 std::string contents;
80 service_->DownloadFile( 80 service_->DownloadFile(
81 FilePath(FILE_PATH_LITERAL("/dummy/gdata/testfile.txt")), 81 FilePath(FILE_PATH_LITERAL("/dummy/gdata/testfile.txt")),
82 GetTestCachedFilePath(FilePath( 82 GetTestCachedFilePath(FilePath(
83 FILE_PATH_LITERAL("cached_testfile.txt"))), 83 FILE_PATH_LITERAL("cached_testfile.txt"))),
84 gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"), 84 gdata_test_server_.GetURL("files/chromeos/gdata/testfile.txt"),
85 std::string(),
kochi 2012/10/16 05:04:58 Can you add a comment?
tzik 2012/10/16 05:48:05 Done.
85 base::Bind(&TestDownloadCallback, &result, &contents), 86 base::Bind(&TestDownloadCallback, &result, &contents),
86 gdata::GetContentCallback()); 87 gdata::GetContentCallback());
87 content::RunMessageLoop(); 88 content::RunMessageLoop();
88 89
89 EXPECT_EQ(gdata::HTTP_SUCCESS, result); 90 EXPECT_EQ(gdata::HTTP_SUCCESS, result);
90 FilePath expected_filepath = gdata_test_server_.document_root().Append( 91 FilePath expected_filepath = gdata_test_server_.document_root().Append(
91 FilePath(FILE_PATH_LITERAL("chromeos/gdata/testfile.txt"))); 92 FilePath(FILE_PATH_LITERAL("chromeos/gdata/testfile.txt")));
92 std::string expected_contents; 93 std::string expected_contents;
93 file_util::ReadFileToString(expected_filepath, &expected_contents); 94 file_util::ReadFileToString(expected_filepath, &expected_contents);
94 EXPECT_EQ(expected_contents, contents); 95 EXPECT_EQ(expected_contents, contents);
95 } 96 }
96 97
97 IN_PROC_BROWSER_TEST_F(GDataTest, NonExistingDownload) { 98 IN_PROC_BROWSER_TEST_F(GDataTest, NonExistingDownload) {
98 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; 99 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR;
99 std::string dummy_contents; 100 std::string dummy_contents;
100 service_->DownloadFile( 101 service_->DownloadFile(
101 FilePath(FILE_PATH_LITERAL("/dummy/gdata/no-such-file.txt")), 102 FilePath(FILE_PATH_LITERAL("/dummy/gdata/no-such-file.txt")),
102 GetTestCachedFilePath(FilePath( 103 GetTestCachedFilePath(FilePath(
103 FILE_PATH_LITERAL("cache_no-such-file.txt"))), 104 FILE_PATH_LITERAL("cache_no-such-file.txt"))),
104 gdata_test_server_.GetURL("files/chromeos/gdata/no-such-file.txt"), 105 gdata_test_server_.GetURL("files/chromeos/gdata/no-such-file.txt"),
106 std::string(),
kochi 2012/10/16 05:04:58 Ditto.
tzik 2012/10/16 05:48:05 Done.
105 base::Bind(&TestDownloadCallback, &result, &dummy_contents), 107 base::Bind(&TestDownloadCallback, &result, &dummy_contents),
106 gdata::GetContentCallback()); 108 gdata::GetContentCallback());
107 content::RunMessageLoop(); 109 content::RunMessageLoop();
108 110
109 EXPECT_EQ(gdata::HTTP_NOT_FOUND, result); 111 EXPECT_EQ(gdata::HTTP_NOT_FOUND, result);
110 // Do not verify the not found message. 112 // Do not verify the not found message.
111 } 113 }
112 114
113 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) { 115 IN_PROC_BROWSER_TEST_F(GDataTest, GetDocuments) {
114 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR; 116 gdata::GDataErrorCode result = gdata::GDATA_OTHER_ERROR;
(...skipping 29 matching lines...) Expand all
144 std::string(), // search string 146 std::string(), // search string
145 std::string(), // directory resource ID 147 std::string(), // directory resource ID
146 base::Bind(&TestGetDocumentsCallback, &result, &result_data)); 148 base::Bind(&TestGetDocumentsCallback, &result, &result_data));
147 content::RunMessageLoop(); 149 content::RunMessageLoop();
148 150
149 EXPECT_EQ(gdata::GDATA_PARSE_ERROR, result); 151 EXPECT_EQ(gdata::GDATA_PARSE_ERROR, result);
150 EXPECT_FALSE(result_data); 152 EXPECT_FALSE(result_data);
151 } 153 }
152 154
153 } // namespace drive 155 } // namespace drive
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698