OLD | NEW |
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 <algorithm> | 5 #include <algorithm> |
6 #include <map> | 6 #include <map> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 const GURL absolute_url = test_server_.GetURL(request.relative_url); | 101 const GURL absolute_url = test_server_.GetURL(request.relative_url); |
102 std::string remaining_path; | 102 std::string remaining_path; |
103 if (absolute_url.path() == "/feeds/default/private/full" && | 103 if (absolute_url.path() == "/feeds/default/private/full" && |
104 request.method == net::test_server::METHOD_POST) { | 104 request.method == net::test_server::METHOD_POST) { |
105 // This is a request for copying a document. | 105 // This is a request for copying a document. |
106 // TODO(satorux): we should generate valid JSON data for the newly | 106 // TODO(satorux): we should generate valid JSON data for the newly |
107 // copied document but for now, just return "file_entry.json" | 107 // copied document but for now, just return "file_entry.json" |
108 scoped_ptr<net::test_server::BasicHttpResponse> result( | 108 scoped_ptr<net::test_server::BasicHttpResponse> result( |
109 test_util::CreateHttpResponseFromFile( | 109 test_util::CreateHttpResponseFromFile( |
110 test_util::GetTestFilePath("chromeos/gdata/file_entry.json"))); | 110 test_util::GetTestFilePath("gdata/file_entry.json"))); |
111 return result.PassAs<net::test_server::HttpResponse>(); | 111 return result.PassAs<net::test_server::HttpResponse>(); |
112 } | 112 } |
113 | 113 |
114 if (!test_util::RemovePrefix(absolute_url.path(), | 114 if (!test_util::RemovePrefix(absolute_url.path(), |
115 "/feeds/default/private/full", | 115 "/feeds/default/private/full", |
116 &remaining_path)) { | 116 &remaining_path)) { |
117 return scoped_ptr<net::test_server::HttpResponse>(); | 117 return scoped_ptr<net::test_server::HttpResponse>(); |
118 } | 118 } |
119 | 119 |
120 if (remaining_path.empty()) { | 120 if (remaining_path.empty()) { |
121 // Process the default feed. | 121 // Process the default feed. |
122 scoped_ptr<net::test_server::BasicHttpResponse> result( | 122 scoped_ptr<net::test_server::BasicHttpResponse> result( |
123 test_util::CreateHttpResponseFromFile( | 123 test_util::CreateHttpResponseFromFile( |
124 test_util::GetTestFilePath("chromeos/gdata/root_feed.json"))); | 124 test_util::GetTestFilePath("gdata/root_feed.json"))); |
125 return result.PassAs<net::test_server::HttpResponse>(); | 125 return result.PassAs<net::test_server::HttpResponse>(); |
126 } else { | 126 } else { |
127 // Process a feed for a single resource ID. | 127 // Process a feed for a single resource ID. |
128 const std::string resource_id = net::UnescapeURLComponent( | 128 const std::string resource_id = net::UnescapeURLComponent( |
129 remaining_path.substr(1), net::UnescapeRule::URL_SPECIAL_CHARS); | 129 remaining_path.substr(1), net::UnescapeRule::URL_SPECIAL_CHARS); |
130 if (resource_id == "file:2_file_resource_id") { | 130 if (resource_id == "file:2_file_resource_id") { |
131 scoped_ptr<net::test_server::BasicHttpResponse> result( | 131 scoped_ptr<net::test_server::BasicHttpResponse> result( |
132 test_util::CreateHttpResponseFromFile( | 132 test_util::CreateHttpResponseFromFile( |
133 test_util::GetTestFilePath("chromeos/gdata/file_entry.json"))); | 133 test_util::GetTestFilePath("gdata/file_entry.json"))); |
134 return result.PassAs<net::test_server::HttpResponse>(); | 134 return result.PassAs<net::test_server::HttpResponse>(); |
135 } else if (resource_id == "folder:root/contents" && | 135 } else if (resource_id == "folder:root/contents" && |
136 request.method == net::test_server::METHOD_POST) { | 136 request.method == net::test_server::METHOD_POST) { |
137 // This is a request for creating a directory in the root directory. | 137 // This is a request for creating a directory in the root directory. |
138 // TODO(satorux): we should generate valid JSON data for the newly | 138 // TODO(satorux): we should generate valid JSON data for the newly |
139 // created directory but for now, just return "directory_entry.json" | 139 // created directory but for now, just return "directory_entry.json" |
140 scoped_ptr<net::test_server::BasicHttpResponse> result( | 140 scoped_ptr<net::test_server::BasicHttpResponse> result( |
141 test_util::CreateHttpResponseFromFile( | 141 test_util::CreateHttpResponseFromFile( |
142 test_util::GetTestFilePath( | 142 test_util::GetTestFilePath( |
143 "chromeos/gdata/directory_entry.json"))); | 143 "gdata/directory_entry.json"))); |
144 return result.PassAs<net::test_server::HttpResponse>(); | 144 return result.PassAs<net::test_server::HttpResponse>(); |
145 } else if (resource_id == | 145 } else if (resource_id == |
146 "folder:root/contents/file:2_file_resource_id" && | 146 "folder:root/contents/file:2_file_resource_id" && |
147 request.method == net::test_server::METHOD_DELETE) { | 147 request.method == net::test_server::METHOD_DELETE) { |
148 // This is a request for deleting a file from the root directory. | 148 // This is a request for deleting a file from the root directory. |
149 // TODO(satorux): Investigate what's returned from the server, and | 149 // TODO(satorux): Investigate what's returned from the server, and |
150 // copy it. For now, just return a random file, as the contents don't | 150 // copy it. For now, just return a random file, as the contents don't |
151 // matter. | 151 // matter. |
152 scoped_ptr<net::test_server::BasicHttpResponse> result( | 152 scoped_ptr<net::test_server::BasicHttpResponse> result( |
153 test_util::CreateHttpResponseFromFile( | 153 test_util::CreateHttpResponseFromFile( |
154 test_util::GetTestFilePath("chromeos/gdata/testfile.txt"))); | 154 test_util::GetTestFilePath("gdata/testfile.txt"))); |
155 return result.PassAs<net::test_server::HttpResponse>(); | 155 return result.PassAs<net::test_server::HttpResponse>(); |
156 } else if (resource_id == "invalid_resource_id") { | 156 } else if (resource_id == "invalid_resource_id") { |
157 // Check if this is an authorization request for an app. | 157 // Check if this is an authorization request for an app. |
158 // This emulates to return invalid formatted result from the server. | 158 // This emulates to return invalid formatted result from the server. |
159 if (request.method == net::test_server::METHOD_PUT && | 159 if (request.method == net::test_server::METHOD_PUT && |
160 request.content.find("<docs:authorizedApp>") != std::string::npos) { | 160 request.content.find("<docs:authorizedApp>") != std::string::npos) { |
161 scoped_ptr<net::test_server::BasicHttpResponse> result( | 161 scoped_ptr<net::test_server::BasicHttpResponse> result( |
162 test_util::CreateHttpResponseFromFile( | 162 test_util::CreateHttpResponseFromFile( |
163 test_util::GetTestFilePath("chromeos/gdata/testfile.txt"))); | 163 test_util::GetTestFilePath("gdata/testfile.txt"))); |
164 return result.PassAs<net::test_server::HttpResponse>(); | 164 return result.PassAs<net::test_server::HttpResponse>(); |
165 } | 165 } |
166 } | 166 } |
167 } | 167 } |
168 | 168 |
169 return scoped_ptr<net::test_server::HttpResponse>(); | 169 return scoped_ptr<net::test_server::HttpResponse>(); |
170 } | 170 } |
171 | 171 |
172 // Handles a request for fetching a metadata feed. | 172 // Handles a request for fetching a metadata feed. |
173 scoped_ptr<net::test_server::HttpResponse> HandleMetadataRequest( | 173 scoped_ptr<net::test_server::HttpResponse> HandleMetadataRequest( |
174 const net::test_server::HttpRequest& request) { | 174 const net::test_server::HttpRequest& request) { |
175 http_request_ = request; | 175 http_request_ = request; |
176 | 176 |
177 const GURL absolute_url = test_server_.GetURL(request.relative_url); | 177 const GURL absolute_url = test_server_.GetURL(request.relative_url); |
178 if (absolute_url.path() != "/feeds/metadata/default") | 178 if (absolute_url.path() != "/feeds/metadata/default") |
179 return scoped_ptr<net::test_server::HttpResponse>(); | 179 return scoped_ptr<net::test_server::HttpResponse>(); |
180 | 180 |
181 scoped_ptr<net::test_server::BasicHttpResponse> result( | 181 scoped_ptr<net::test_server::BasicHttpResponse> result( |
182 test_util::CreateHttpResponseFromFile( | 182 test_util::CreateHttpResponseFromFile( |
183 test_util::GetTestFilePath( | 183 test_util::GetTestFilePath( |
184 "chromeos/gdata/account_metadata.json"))); | 184 "gdata/account_metadata.json"))); |
185 if (absolute_url.query().find("include-installed-apps=true") == | 185 if (absolute_url.query().find("include-installed-apps=true") == |
186 string::npos) { | 186 string::npos) { |
187 // Exclude the list of installed apps. | 187 // Exclude the list of installed apps. |
188 scoped_ptr<base::Value> parsed_content( | 188 scoped_ptr<base::Value> parsed_content( |
189 base::JSONReader::Read(result->content(), base::JSON_PARSE_RFC)); | 189 base::JSONReader::Read(result->content(), base::JSON_PARSE_RFC)); |
190 CHECK(parsed_content); | 190 CHECK(parsed_content); |
191 | 191 |
192 // Remove the install apps node. | 192 // Remove the install apps node. |
193 base::DictionaryValue* dictionary_value; | 193 base::DictionaryValue* dictionary_value; |
194 CHECK(parsed_content->GetAsDictionary(&dictionary_value)); | 194 CHECK(parsed_content->GetAsDictionary(&dictionary_value)); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 const GURL absolute_url = test_server_.GetURL(request.relative_url); | 260 const GURL absolute_url = test_server_.GetURL(request.relative_url); |
261 if (absolute_url.path() != "/upload_new_file" && | 261 if (absolute_url.path() != "/upload_new_file" && |
262 absolute_url.path() != "/upload_existing_file") { | 262 absolute_url.path() != "/upload_existing_file") { |
263 return scoped_ptr<net::test_server::HttpResponse>(); | 263 return scoped_ptr<net::test_server::HttpResponse>(); |
264 } | 264 } |
265 | 265 |
266 // TODO(satorux): We should create a correct JSON data for the uploaded | 266 // TODO(satorux): We should create a correct JSON data for the uploaded |
267 // file, but for now, just return file_entry.json. | 267 // file, but for now, just return file_entry.json. |
268 scoped_ptr<net::test_server::BasicHttpResponse> response = | 268 scoped_ptr<net::test_server::BasicHttpResponse> response = |
269 test_util::CreateHttpResponseFromFile( | 269 test_util::CreateHttpResponseFromFile( |
270 test_util::GetTestFilePath("chromeos/gdata/file_entry.json")); | 270 test_util::GetTestFilePath("gdata/file_entry.json")); |
271 // response.code() is set to SUCCESS. Change it to CREATED if it's a new | 271 // response.code() is set to SUCCESS. Change it to CREATED if it's a new |
272 // file. | 272 // file. |
273 if (absolute_url.path() == "/upload_new_file") | 273 if (absolute_url.path() == "/upload_new_file") |
274 response->set_code(net::HTTP_CREATED); | 274 response->set_code(net::HTTP_CREATED); |
275 | 275 |
276 // Check if the Content-Range header is present. This must be present if | 276 // Check if the Content-Range header is present. This must be present if |
277 // the request body is not empty. | 277 // the request body is not empty. |
278 if (!request.content.empty()) { | 278 if (!request.content.empty()) { |
279 std::map<std::string, std::string>::const_iterator iter = | 279 std::map<std::string, std::string>::const_iterator iter = |
280 request.headers.find("Content-Range"); | 280 request.headers.find("Content-Range"); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 | 357 |
358 EXPECT_EQ(HTTP_SUCCESS, result_code); | 358 EXPECT_EQ(HTTP_SUCCESS, result_code); |
359 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 359 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
360 EXPECT_EQ("/feeds/default/private/full?v=3&alt=json&showroot=true&" | 360 EXPECT_EQ("/feeds/default/private/full?v=3&alt=json&showroot=true&" |
361 "showfolders=true&include-shared=true&max-results=500", | 361 "showfolders=true&include-shared=true&max-results=500", |
362 http_request_.relative_url); | 362 http_request_.relative_url); |
363 | 363 |
364 // Sanity check of the result. | 364 // Sanity check of the result. |
365 scoped_ptr<ResourceList> expected( | 365 scoped_ptr<ResourceList> expected( |
366 ResourceList::ExtractAndParse( | 366 ResourceList::ExtractAndParse( |
367 *test_util::LoadJSONFile("chromeos/gdata/root_feed.json"))); | 367 *test_util::LoadJSONFile("gdata/root_feed.json"))); |
368 ASSERT_TRUE(result_data); | 368 ASSERT_TRUE(result_data); |
369 EXPECT_EQ(expected->title(), result_data->title()); | 369 EXPECT_EQ(expected->title(), result_data->title()); |
370 } | 370 } |
371 | 371 |
372 TEST_F(GDataWapiRequestsTest, GetResourceListRequest_ValidFeed) { | 372 TEST_F(GDataWapiRequestsTest, GetResourceListRequest_ValidFeed) { |
373 GDataErrorCode result_code = GDATA_OTHER_ERROR; | 373 GDataErrorCode result_code = GDATA_OTHER_ERROR; |
374 scoped_ptr<ResourceList> result_data; | 374 scoped_ptr<ResourceList> result_data; |
375 | 375 |
376 { | 376 { |
377 base::RunLoop run_loop; | 377 base::RunLoop run_loop; |
378 GetResourceListRequest* request = new GetResourceListRequest( | 378 GetResourceListRequest* request = new GetResourceListRequest( |
379 request_sender_.get(), | 379 request_sender_.get(), |
380 *url_generator_, | 380 *url_generator_, |
381 test_server_.GetURL("/files/chromeos/gdata/root_feed.json"), | 381 test_server_.GetURL("/files/gdata/root_feed.json"), |
382 0, // start changestamp | 382 0, // start changestamp |
383 std::string(), // search string | 383 std::string(), // search string |
384 std::string(), // directory resource ID | 384 std::string(), // directory resource ID |
385 test_util::CreateQuitCallback( | 385 test_util::CreateQuitCallback( |
386 &run_loop, | 386 &run_loop, |
387 test_util::CreateCopyResultCallback(&result_code, &result_data))); | 387 test_util::CreateCopyResultCallback(&result_code, &result_data))); |
388 request_sender_->StartRequestWithRetry(request); | 388 request_sender_->StartRequestWithRetry(request); |
389 run_loop.Run(); | 389 run_loop.Run(); |
390 } | 390 } |
391 | 391 |
392 EXPECT_EQ(HTTP_SUCCESS, result_code); | 392 EXPECT_EQ(HTTP_SUCCESS, result_code); |
393 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 393 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
394 EXPECT_EQ("/files/chromeos/gdata/root_feed.json?v=3&alt=json&showroot=true&" | 394 EXPECT_EQ("/files/gdata/root_feed.json?v=3&alt=json&showroot=true&" |
395 "showfolders=true&include-shared=true&max-results=500", | 395 "showfolders=true&include-shared=true&max-results=500", |
396 http_request_.relative_url); | 396 http_request_.relative_url); |
397 | 397 |
398 scoped_ptr<ResourceList> expected( | 398 scoped_ptr<ResourceList> expected( |
399 ResourceList::ExtractAndParse( | 399 ResourceList::ExtractAndParse( |
400 *test_util::LoadJSONFile("chromeos/gdata/root_feed.json"))); | 400 *test_util::LoadJSONFile("gdata/root_feed.json"))); |
401 ASSERT_TRUE(result_data); | 401 ASSERT_TRUE(result_data); |
402 EXPECT_EQ(expected->title(), result_data->title()); | 402 EXPECT_EQ(expected->title(), result_data->title()); |
403 } | 403 } |
404 | 404 |
405 TEST_F(GDataWapiRequestsTest, GetResourceListRequest_InvalidFeed) { | 405 TEST_F(GDataWapiRequestsTest, GetResourceListRequest_InvalidFeed) { |
406 // testfile.txt exists but the response is not JSON, so it should | 406 // testfile.txt exists but the response is not JSON, so it should |
407 // emit a parse error instead. | 407 // emit a parse error instead. |
408 GDataErrorCode result_code = GDATA_OTHER_ERROR; | 408 GDataErrorCode result_code = GDATA_OTHER_ERROR; |
409 scoped_ptr<ResourceList> result_data; | 409 scoped_ptr<ResourceList> result_data; |
410 | 410 |
411 { | 411 { |
412 base::RunLoop run_loop; | 412 base::RunLoop run_loop; |
413 GetResourceListRequest* request = new GetResourceListRequest( | 413 GetResourceListRequest* request = new GetResourceListRequest( |
414 request_sender_.get(), | 414 request_sender_.get(), |
415 *url_generator_, | 415 *url_generator_, |
416 test_server_.GetURL("/files/chromeos/gdata/testfile.txt"), | 416 test_server_.GetURL("/files/gdata/testfile.txt"), |
417 0, // start changestamp | 417 0, // start changestamp |
418 std::string(), // search string | 418 std::string(), // search string |
419 std::string(), // directory resource ID | 419 std::string(), // directory resource ID |
420 test_util::CreateQuitCallback( | 420 test_util::CreateQuitCallback( |
421 &run_loop, | 421 &run_loop, |
422 test_util::CreateCopyResultCallback(&result_code, &result_data))); | 422 test_util::CreateCopyResultCallback(&result_code, &result_data))); |
423 request_sender_->StartRequestWithRetry(request); | 423 request_sender_->StartRequestWithRetry(request); |
424 run_loop.Run(); | 424 run_loop.Run(); |
425 } | 425 } |
426 | 426 |
427 EXPECT_EQ(GDATA_PARSE_ERROR, result_code); | 427 EXPECT_EQ(GDATA_PARSE_ERROR, result_code); |
428 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 428 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
429 EXPECT_EQ("/files/chromeos/gdata/testfile.txt?v=3&alt=json&showroot=true&" | 429 EXPECT_EQ("/files/gdata/testfile.txt?v=3&alt=json&showroot=true&" |
430 "showfolders=true&include-shared=true&max-results=500", | 430 "showfolders=true&include-shared=true&max-results=500", |
431 http_request_.relative_url); | 431 http_request_.relative_url); |
432 EXPECT_FALSE(result_data); | 432 EXPECT_FALSE(result_data); |
433 } | 433 } |
434 | 434 |
435 TEST_F(GDataWapiRequestsTest, SearchByTitleRequest) { | 435 TEST_F(GDataWapiRequestsTest, SearchByTitleRequest) { |
436 GDataErrorCode result_code = GDATA_OTHER_ERROR; | 436 GDataErrorCode result_code = GDATA_OTHER_ERROR; |
437 scoped_ptr<ResourceList> result_data; | 437 scoped_ptr<ResourceList> result_data; |
438 | 438 |
439 { | 439 { |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 request_sender_->StartRequestWithRetry(request); | 475 request_sender_->StartRequestWithRetry(request); |
476 run_loop.Run(); | 476 run_loop.Run(); |
477 } | 477 } |
478 | 478 |
479 EXPECT_EQ(HTTP_SUCCESS, result_code); | 479 EXPECT_EQ(HTTP_SUCCESS, result_code); |
480 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 480 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
481 EXPECT_EQ("/feeds/default/private/full/file%3A2_file_resource_id" | 481 EXPECT_EQ("/feeds/default/private/full/file%3A2_file_resource_id" |
482 "?v=3&alt=json&showroot=true", | 482 "?v=3&alt=json&showroot=true", |
483 http_request_.relative_url); | 483 http_request_.relative_url); |
484 EXPECT_TRUE(test_util::VerifyJsonData( | 484 EXPECT_TRUE(test_util::VerifyJsonData( |
485 test_util::GetTestFilePath("chromeos/gdata/file_entry.json"), | 485 test_util::GetTestFilePath("gdata/file_entry.json"), |
486 result_data.get())); | 486 result_data.get())); |
487 } | 487 } |
488 | 488 |
489 TEST_F(GDataWapiRequestsTest, GetResourceEntryRequest_InvalidResourceId) { | 489 TEST_F(GDataWapiRequestsTest, GetResourceEntryRequest_InvalidResourceId) { |
490 GDataErrorCode result_code = GDATA_OTHER_ERROR; | 490 GDataErrorCode result_code = GDATA_OTHER_ERROR; |
491 scoped_ptr<base::Value> result_data; | 491 scoped_ptr<base::Value> result_data; |
492 | 492 |
493 { | 493 { |
494 base::RunLoop run_loop; | 494 base::RunLoop run_loop; |
495 GetResourceEntryRequest* request = new GetResourceEntryRequest( | 495 GetResourceEntryRequest* request = new GetResourceEntryRequest( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
529 } | 529 } |
530 | 530 |
531 EXPECT_EQ(HTTP_SUCCESS, result_code); | 531 EXPECT_EQ(HTTP_SUCCESS, result_code); |
532 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 532 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
533 EXPECT_EQ("/feeds/metadata/default?v=3&alt=json&showroot=true" | 533 EXPECT_EQ("/feeds/metadata/default?v=3&alt=json&showroot=true" |
534 "&include-installed-apps=true", | 534 "&include-installed-apps=true", |
535 http_request_.relative_url); | 535 http_request_.relative_url); |
536 | 536 |
537 scoped_ptr<AccountMetadata> expected( | 537 scoped_ptr<AccountMetadata> expected( |
538 AccountMetadata::CreateFrom( | 538 AccountMetadata::CreateFrom( |
539 *test_util::LoadJSONFile("chromeos/gdata/account_metadata.json"))); | 539 *test_util::LoadJSONFile("gdata/account_metadata.json"))); |
540 | 540 |
541 ASSERT_TRUE(result_data.get()); | 541 ASSERT_TRUE(result_data.get()); |
542 EXPECT_EQ(expected->largest_changestamp(), | 542 EXPECT_EQ(expected->largest_changestamp(), |
543 result_data->largest_changestamp()); | 543 result_data->largest_changestamp()); |
544 EXPECT_EQ(expected->quota_bytes_total(), | 544 EXPECT_EQ(expected->quota_bytes_total(), |
545 result_data->quota_bytes_total()); | 545 result_data->quota_bytes_total()); |
546 EXPECT_EQ(expected->quota_bytes_used(), | 546 EXPECT_EQ(expected->quota_bytes_used(), |
547 result_data->quota_bytes_used()); | 547 result_data->quota_bytes_used()); |
548 | 548 |
549 // Sanity check for installed apps. | 549 // Sanity check for installed apps. |
(...skipping 19 matching lines...) Expand all Loading... |
569 run_loop.Run(); | 569 run_loop.Run(); |
570 } | 570 } |
571 | 571 |
572 EXPECT_EQ(HTTP_SUCCESS, result_code); | 572 EXPECT_EQ(HTTP_SUCCESS, result_code); |
573 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); | 573 EXPECT_EQ(net::test_server::METHOD_GET, http_request_.method); |
574 EXPECT_EQ("/feeds/metadata/default?v=3&alt=json&showroot=true", | 574 EXPECT_EQ("/feeds/metadata/default?v=3&alt=json&showroot=true", |
575 http_request_.relative_url); | 575 http_request_.relative_url); |
576 | 576 |
577 scoped_ptr<AccountMetadata> expected( | 577 scoped_ptr<AccountMetadata> expected( |
578 AccountMetadata::CreateFrom( | 578 AccountMetadata::CreateFrom( |
579 *test_util::LoadJSONFile("chromeos/gdata/account_metadata.json"))); | 579 *test_util::LoadJSONFile("gdata/account_metadata.json"))); |
580 | 580 |
581 ASSERT_TRUE(result_data.get()); | 581 ASSERT_TRUE(result_data.get()); |
582 EXPECT_EQ(expected->largest_changestamp(), | 582 EXPECT_EQ(expected->largest_changestamp(), |
583 result_data->largest_changestamp()); | 583 result_data->largest_changestamp()); |
584 EXPECT_EQ(expected->quota_bytes_total(), | 584 EXPECT_EQ(expected->quota_bytes_total(), |
585 result_data->quota_bytes_total()); | 585 result_data->quota_bytes_total()); |
586 EXPECT_EQ(expected->quota_bytes_used(), | 586 EXPECT_EQ(expected->quota_bytes_used(), |
587 result_data->quota_bytes_used()); | 587 result_data->quota_bytes_used()); |
588 | 588 |
589 // Installed apps shouldn't be included. | 589 // Installed apps shouldn't be included. |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 EXPECT_EQ(base::Int64ToString(kUploadContent.size()), | 1535 EXPECT_EQ(base::Int64ToString(kUploadContent.size()), |
1536 http_request_.headers["X-Upload-Content-Length"]); | 1536 http_request_.headers["X-Upload-Content-Length"]); |
1537 // For updating an existing file, an empty body should be attached (PUT | 1537 // For updating an existing file, an empty body should be attached (PUT |
1538 // requires a body) | 1538 // requires a body) |
1539 EXPECT_TRUE(http_request_.has_content); | 1539 EXPECT_TRUE(http_request_.has_content); |
1540 EXPECT_EQ("", http_request_.content); | 1540 EXPECT_EQ("", http_request_.content); |
1541 EXPECT_EQ(kWrongETag, http_request_.headers["If-Match"]); | 1541 EXPECT_EQ(kWrongETag, http_request_.headers["If-Match"]); |
1542 } | 1542 } |
1543 | 1543 |
1544 } // namespace google_apis | 1544 } // namespace google_apis |
OLD | NEW |