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

Unified Diff: google_apis/drive/base_requests_unittest.cc

Issue 442193002: Parse Drive API responses all at once in the blocking pool. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the cause of the regression. Created 6 years, 4 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 | « google_apis/drive/base_requests.cc ('k') | google_apis/drive/drive_api_requests.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/base_requests_unittest.cc
diff --git a/google_apis/drive/base_requests_unittest.cc b/google_apis/drive/base_requests_unittest.cc
index f3a97c191562d848c86e51a7f75721aed2ec5fdd..819f3e79d283c8ea31487be515d5ddcf12ac4520 100644
--- a/google_apis/drive/base_requests_unittest.cc
+++ b/google_apis/drive/base_requests_unittest.cc
@@ -51,24 +51,6 @@ class FakeUrlFetchRequest : public UrlFetchRequestBase {
GURL url_;
};
-class FakeGetDataRequest : public GetDataRequest {
- public:
- explicit FakeGetDataRequest(RequestSender* sender,
- const GetDataCallback& callback,
- const GURL& url)
- : GetDataRequest(sender, callback),
- url_(url) {
- }
-
- virtual ~FakeGetDataRequest() {
- }
-
- protected:
- virtual GURL GetURL() const OVERRIDE { return url_; }
-
- GURL url_;
-};
-
} // namespace
class BaseRequestsTest : public testing::Test {
@@ -109,11 +91,7 @@ class BaseRequestsTest : public testing::Test {
};
TEST_F(BaseRequestsTest, ParseValidJson) {
- scoped_ptr<base::Value> json;
- ParseJson(message_loop_.message_loop_proxy(),
- kValidJsonString,
- base::Bind(test_util::CreateCopyResultCallback(&json)));
- base::RunLoop().RunUntilIdle();
+ scoped_ptr<base::Value> json(ParseJson(kValidJsonString));
base::DictionaryValue* root_dict = NULL;
ASSERT_TRUE(json);
@@ -125,14 +103,7 @@ TEST_F(BaseRequestsTest, ParseValidJson) {
}
TEST_F(BaseRequestsTest, ParseInvalidJson) {
- // Initialize with a valid pointer to verify that null is indeed assigned.
- scoped_ptr<base::Value> json(base::Value::CreateNullValue());
- ParseJson(message_loop_.message_loop_proxy(),
- kInvalidJsonString,
- base::Bind(test_util::CreateCopyResultCallback(&json)));
- base::RunLoop().RunUntilIdle();
-
- EXPECT_FALSE(json);
+ EXPECT_FALSE(ParseJson(kInvalidJsonString));
}
TEST_F(BaseRequestsTest, UrlFetchRequestBaseResponseCodeOverride) {
@@ -165,40 +136,4 @@ TEST_F(BaseRequestsTest, UrlFetchRequestBaseResponseCodeOverride) {
EXPECT_EQ(HTTP_SERVICE_UNAVAILABLE, error);
}
-TEST_F(BaseRequestsTest, GetDataRequestParseValidResponse) {
- response_body_ = kValidJsonString;
-
- GDataErrorCode error = GDATA_OTHER_ERROR;
- scoped_ptr<base::Value> value;
- base::RunLoop run_loop;
- sender_->StartRequestWithRetry(
- new FakeGetDataRequest(
- sender_.get(),
- test_util::CreateQuitCallback(
- &run_loop, test_util::CreateCopyResultCallback(&error, &value)),
- test_server_.base_url()));
- run_loop.Run();
-
- EXPECT_EQ(HTTP_SUCCESS, error);
- EXPECT_TRUE(value);
-}
-
-TEST_F(BaseRequestsTest, GetDataRequestParseInvalidResponse) {
- response_body_ = kInvalidJsonString;
-
- GDataErrorCode error = GDATA_OTHER_ERROR;
- scoped_ptr<base::Value> value;
- base::RunLoop run_loop;
- sender_->StartRequestWithRetry(
- new FakeGetDataRequest(
- sender_.get(),
- test_util::CreateQuitCallback(
- &run_loop, test_util::CreateCopyResultCallback(&error, &value)),
- test_server_.base_url()));
- run_loop.Run();
-
- EXPECT_EQ(GDATA_PARSE_ERROR, error);
- EXPECT_FALSE(value);
-}
-
} // namespace google_apis
« no previous file with comments | « google_apis/drive/base_requests.cc ('k') | google_apis/drive/drive_api_requests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698