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: webkit/fileapi/file_system_url_request_job_unittest.cc

Issue 7846007: net: Rename URLRequestStatus::os_error_. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix os_error_code Created 9 years, 3 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit) 5 // NOTE: These tests are run as part of "unit_tests" (in chrome/test/unit)
6 // rather than as part of test_shell_tests because they rely on being able 6 // rather than as part of test_shell_tests because they rely on being able
7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses 7 // to instantiate a MessageLoop of type TYPE_IO. test_shell_tests uses
8 // TYPE_UI, which URLRequest doesn't allow. 8 // TYPE_UI, which URLRequest doesn't allow.
9 // 9 //
10 10
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 279
280 TEST_F(FileSystemURLRequestJobTest, FileTestMultipleRangesNotSupported) { 280 TEST_F(FileSystemURLRequestJobTest, FileTestMultipleRangesNotSupported) {
281 WriteFile("file1.dat", kTestFileData, arraysize(kTestFileData) - 1); 281 WriteFile("file1.dat", kTestFileData, arraysize(kTestFileData) - 1);
282 net::HttpRequestHeaders headers; 282 net::HttpRequestHeaders headers;
283 headers.SetHeader(net::HttpRequestHeaders::kRange, 283 headers.SetHeader(net::HttpRequestHeaders::kRange,
284 "bytes=0-5,10-200,200-300"); 284 "bytes=0-5,10-200,200-300");
285 TestRequestWithHeaders(CreateFileSystemURL("file1.dat"), &headers); 285 TestRequestWithHeaders(CreateFileSystemURL("file1.dat"), &headers);
286 EXPECT_TRUE(delegate_->request_failed()); 286 EXPECT_TRUE(delegate_->request_failed());
287 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, 287 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE,
288 request_->status().os_error()); 288 request_->status().error());
289 } 289 }
290 290
291 TEST_F(FileSystemURLRequestJobTest, RangeOutOfBounds) { 291 TEST_F(FileSystemURLRequestJobTest, RangeOutOfBounds) {
292 WriteFile("file1.dat", kTestFileData, arraysize(kTestFileData) - 1); 292 WriteFile("file1.dat", kTestFileData, arraysize(kTestFileData) - 1);
293 net::HttpRequestHeaders headers; 293 net::HttpRequestHeaders headers;
294 headers.SetHeader(net::HttpRequestHeaders::kRange, "bytes=500-1000"); 294 headers.SetHeader(net::HttpRequestHeaders::kRange, "bytes=500-1000");
295 TestRequestWithHeaders(CreateFileSystemURL("file1.dat"), &headers); 295 TestRequestWithHeaders(CreateFileSystemURL("file1.dat"), &headers);
296 296
297 ASSERT_FALSE(request_->is_pending()); 297 ASSERT_FALSE(request_->is_pending());
298 EXPECT_TRUE(delegate_->request_failed()); 298 EXPECT_TRUE(delegate_->request_failed());
299 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE, 299 EXPECT_EQ(net::ERR_REQUEST_RANGE_NOT_SATISFIABLE,
300 request_->status().os_error()); 300 request_->status().error());
301 } 301 }
302 302
303 TEST_F(FileSystemURLRequestJobTest, FileDirRedirect) { 303 TEST_F(FileSystemURLRequestJobTest, FileDirRedirect) {
304 CreateDirectory("dir"); 304 CreateDirectory("dir");
305 TestRequest(CreateFileSystemURL("dir")); 305 TestRequest(CreateFileSystemURL("dir"));
306 306
307 EXPECT_EQ(1, delegate_->received_redirect_count()); 307 EXPECT_EQ(1, delegate_->received_redirect_count());
308 EXPECT_TRUE(request_->status().is_success()); 308 EXPECT_TRUE(request_->status().is_success());
309 EXPECT_FALSE(delegate_->request_failed()); 309 EXPECT_FALSE(delegate_->request_failed());
310 310
311 // We've deferred the redirect; now cancel the request to avoid following it. 311 // We've deferred the redirect; now cancel the request to avoid following it.
312 request_->Cancel(); 312 request_->Cancel();
313 MessageLoop::current()->Run(); 313 MessageLoop::current()->Run();
314 } 314 }
315 315
316 TEST_F(FileSystemURLRequestJobTest, InvalidURL) { 316 TEST_F(FileSystemURLRequestJobTest, InvalidURL) {
317 TestRequest(GURL("filesystem:/foo/bar/baz")); 317 TestRequest(GURL("filesystem:/foo/bar/baz"));
318 ASSERT_FALSE(request_->is_pending()); 318 ASSERT_FALSE(request_->is_pending());
319 EXPECT_TRUE(delegate_->request_failed()); 319 EXPECT_TRUE(delegate_->request_failed());
320 EXPECT_EQ(net::ERR_INVALID_URL, request_->status().os_error()); 320 EXPECT_EQ(net::ERR_INVALID_URL, request_->status().error());
321 } 321 }
322 322
323 TEST_F(FileSystemURLRequestJobTest, NoSuchRoot) { 323 TEST_F(FileSystemURLRequestJobTest, NoSuchRoot) {
324 TestRequest(GURL("filesystem:http://remote/persistent/somefile")); 324 TestRequest(GURL("filesystem:http://remote/persistent/somefile"));
325 ASSERT_FALSE(request_->is_pending()); 325 ASSERT_FALSE(request_->is_pending());
326 EXPECT_TRUE(delegate_->request_failed()); 326 EXPECT_TRUE(delegate_->request_failed());
327 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().os_error()); 327 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error());
328 } 328 }
329 329
330 TEST_F(FileSystemURLRequestJobTest, NoSuchFile) { 330 TEST_F(FileSystemURLRequestJobTest, NoSuchFile) {
331 TestRequest(CreateFileSystemURL("somefile")); 331 TestRequest(CreateFileSystemURL("somefile"));
332 ASSERT_FALSE(request_->is_pending()); 332 ASSERT_FALSE(request_->is_pending());
333 EXPECT_TRUE(delegate_->request_failed()); 333 EXPECT_TRUE(delegate_->request_failed());
334 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().os_error()); 334 EXPECT_EQ(net::ERR_FILE_NOT_FOUND, request_->status().error());
335 } 335 }
336 336
337 class QuitNowTask : public Task { 337 class QuitNowTask : public Task {
338 public: 338 public:
339 virtual void Run() { 339 virtual void Run() {
340 MessageLoop::current()->QuitNow(); 340 MessageLoop::current()->QuitNow();
341 } 341 }
342 }; 342 };
343 343
344 TEST_F(FileSystemURLRequestJobTest, Cancel) { 344 TEST_F(FileSystemURLRequestJobTest, Cancel) {
(...skipping 22 matching lines...) Expand all
367 367
368 TestRequest(CreateFileSystemURL(kFilename)); 368 TestRequest(CreateFileSystemURL(kFilename));
369 369
370 std::string mime_type_from_job; 370 std::string mime_type_from_job;
371 request_->GetMimeType(&mime_type_from_job); 371 request_->GetMimeType(&mime_type_from_job);
372 EXPECT_EQ(mime_type_direct, mime_type_from_job); 372 EXPECT_EQ(mime_type_direct, mime_type_from_job);
373 } 373 }
374 374
375 } // namespace (anonymous) 375 } // namespace (anonymous)
376 } // namespace fileapi 376 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/file_system_dir_url_request_job_unittest.cc ('k') | webkit/glue/weburlloader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698