Chromium Code Reviews| 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 | 5 |
| 6 #include <fcntl.h> | 6 #include <fcntl.h> |
| 7 #include <gmock/gmock.h> | 7 #include <gmock/gmock.h> |
| 8 #include <ppapi/c/ppb_file_io.h> | 8 #include <ppapi/c/ppb_file_io.h> |
| 9 #include <ppapi/c/pp_errors.h> | 9 #include <ppapi/c/pp_errors.h> |
| 10 #include <ppapi/c/pp_instance.h> | 10 #include <ppapi/c/pp_instance.h> |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 22 using ::testing::DoAll; | 22 using ::testing::DoAll; |
| 23 using ::testing::Mock; | 23 using ::testing::Mock; |
| 24 using ::testing::Return; | 24 using ::testing::Return; |
| 25 using ::testing::SetArgPointee; | 25 using ::testing::SetArgPointee; |
| 26 using ::testing::StrEq; | 26 using ::testing::StrEq; |
| 27 | 27 |
| 28 | 28 |
| 29 class MountHttpMock : public MountHttp { | 29 class MountHttpMock : public MountHttp { |
| 30 public: | 30 public: |
| 31 MountHttpMock(StringMap_t map, PepperInterfaceMock* ppapi) { | 31 MountHttpMock(StringMap_t map, PepperInterfaceMock* ppapi) { |
| 32 EXPECT_TRUE(Init(1, map, ppapi)); | 32 EXPECT_EQ(0, Init(1, map, ppapi)); |
| 33 } | 33 } |
| 34 | 34 |
| 35 ~MountHttpMock() { | 35 ~MountHttpMock() { |
| 36 Destroy(); | 36 Destroy(); |
| 37 } | 37 } |
| 38 | 38 |
| 39 NodeMap_t& GetMap() { return node_cache_; } | 39 NodeMap_t& GetMap() { return node_cache_; } |
| 40 | 40 |
| 41 using MountHttp::ParseManifest; | 41 using MountHttp::ParseManifest; |
| 42 using MountHttp::FindOrCreateDir; | 42 using MountHttp::FindOrCreateDir; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 64 } | 64 } |
| 65 | 65 |
| 66 | 66 |
| 67 TEST_F(MountHttpTest, MountEmpty) { | 67 TEST_F(MountHttpTest, MountEmpty) { |
| 68 StringMap_t args; | 68 StringMap_t args; |
| 69 mnt_ = new MountHttpMock(args, &ppapi_); | 69 mnt_ = new MountHttpMock(args, &ppapi_); |
| 70 } | 70 } |
| 71 | 71 |
| 72 TEST_F(MountHttpTest, ParseManifest) { | 72 TEST_F(MountHttpTest, ParseManifest) { |
| 73 StringMap_t args; | 73 StringMap_t args; |
| 74 size_t result_size = 0; | |
| 75 | |
| 74 mnt_ = new MountHttpMock(args, &ppapi_); | 76 mnt_ = new MountHttpMock(args, &ppapi_); |
| 75 | 77 |
| 76 char manifest[] = "-r-- 123 /mydir/foo\n-rw- 234 /thatdir/bar\n"; | 78 char manifest[] = "-r-- 123 /mydir/foo\n-rw- 234 /thatdir/bar\n"; |
| 77 EXPECT_TRUE(mnt_->ParseManifest(manifest)); | 79 EXPECT_EQ(0, mnt_->ParseManifest(manifest)); |
| 78 | 80 |
| 79 MountNodeDir* root = mnt_->FindOrCreateDir(Path("/")); | 81 MountNodeDir* root = NULL; |
| 82 EXPECT_EQ(0, mnt_->FindOrCreateDir(Path("/"), &root)); | |
| 83 ASSERT_NE((MountNode*)NULL, root); | |
| 80 EXPECT_EQ(2, root->ChildCount()); | 84 EXPECT_EQ(2, root->ChildCount()); |
| 81 | 85 |
| 82 MountNodeDir* dir = mnt_->FindOrCreateDir(Path("/mydir")); | 86 MountNodeDir* dir = NULL; |
| 87 EXPECT_EQ(0, mnt_->FindOrCreateDir(Path("/mydir"), &dir)); | |
| 88 ASSERT_NE((MountNode*)NULL, dir); | |
| 83 EXPECT_EQ(1, dir->ChildCount()); | 89 EXPECT_EQ(1, dir->ChildCount()); |
| 84 | 90 |
| 85 MountNode* node = mnt_->GetMap()["/mydir/foo"]; | 91 MountNode* node = mnt_->GetMap()["/mydir/foo"]; |
| 86 EXPECT_TRUE(node); | 92 EXPECT_NE((MountNode*)NULL, node); |
| 87 EXPECT_EQ(123, node->GetSize()); | 93 EXPECT_EQ(0, node->GetSize(&result_size)); |
| 94 EXPECT_EQ(123, result_size); | |
| 88 | 95 |
| 89 // Since these files are cached thanks to the manifest, we can open them | 96 // Since these files are cached thanks to the manifest, we can open them |
| 90 // without accessing the PPAPI URL API. | 97 // without accessing the PPAPI URL API. |
| 91 MountNode* foo = mnt_->Open(Path("/mydir/foo"), O_RDONLY); | 98 MountNode* foo = NULL; |
| 92 MountNode* bar = mnt_->Open(Path("/thatdir/bar"), O_RDWR); | 99 EXPECT_EQ(0, mnt_->Open(Path("/mydir/foo"), O_RDONLY, &foo)); |
| 100 MountNode* bar = NULL; | |
| 101 EXPECT_EQ(0, mnt_->Open(Path("/thatdir/bar"), O_RDWR, &bar)); | |
| 93 | 102 |
| 94 struct stat sfoo; | 103 struct stat sfoo; |
| 95 struct stat sbar; | 104 struct stat sbar; |
| 96 | 105 |
| 97 EXPECT_FALSE(foo->GetStat(&sfoo)); | 106 EXPECT_FALSE(foo->GetStat(&sfoo)); |
| 98 EXPECT_FALSE(bar->GetStat(&sbar)); | 107 EXPECT_FALSE(bar->GetStat(&sbar)); |
| 99 | 108 |
| 100 EXPECT_EQ(123, sfoo.st_size); | 109 EXPECT_EQ(123, sfoo.st_size); |
| 101 EXPECT_EQ(S_IFREG | S_IREAD, sfoo.st_mode); | 110 EXPECT_EQ(S_IFREG | S_IREAD, sfoo.st_mode); |
| 102 | 111 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 } | 250 } |
| 242 | 251 |
| 243 void MountHttpNodeTest::SetResponseBody(const char* body) { | 252 void MountHttpNodeTest::SetResponseBody(const char* body) { |
| 244 response_body_offset_ = 0; | 253 response_body_offset_ = 0; |
| 245 EXPECT_CALL(*loader_, ReadResponseBody(loader_resource_, _, _, _)) | 254 EXPECT_CALL(*loader_, ReadResponseBody(loader_resource_, _, _, _)) |
| 246 .WillRepeatedly(ReadResponseBodyAction( | 255 .WillRepeatedly(ReadResponseBodyAction( |
| 247 &response_body_offset_, body, strlen(body))); | 256 &response_body_offset_, body, strlen(body))); |
| 248 } | 257 } |
| 249 | 258 |
| 250 void MountHttpNodeTest::OpenNode() { | 259 void MountHttpNodeTest::OpenNode() { |
| 251 node_ = mnt_->Open(Path(path_), O_RDONLY); | 260 ASSERT_EQ(0, mnt_->Open(Path(path_), O_RDONLY, &node_)); |
| 252 ASSERT_NE((MountNode*)NULL, node_); | 261 ASSERT_NE((MountNode*)NULL, node_); |
| 253 } | 262 } |
| 254 | 263 |
| 255 void MountHttpNodeTest::ResetMocks() { | 264 void MountHttpNodeTest::ResetMocks() { |
| 256 Mock::VerifyAndClearExpectations(&ppapi_); | 265 Mock::VerifyAndClearExpectations(&ppapi_); |
| 257 Mock::VerifyAndClearExpectations(loader_); | 266 Mock::VerifyAndClearExpectations(loader_); |
| 258 Mock::VerifyAndClearExpectations(request_); | 267 Mock::VerifyAndClearExpectations(request_); |
| 259 Mock::VerifyAndClearExpectations(response_); | 268 Mock::VerifyAndClearExpectations(response_); |
| 260 Mock::VerifyAndClearExpectations(var_); | 269 Mock::VerifyAndClearExpectations(var_); |
| 261 } | 270 } |
| 262 | 271 |
| 263 void MountHttpNodeTest::TearDown() { | 272 void MountHttpNodeTest::TearDown() { |
| 264 if (node_) | 273 if (node_) |
| 265 mnt_->ReleaseNode(node_); | 274 mnt_->ReleaseNode(node_); |
| 266 delete mnt_; | 275 delete mnt_; |
| 267 } | 276 } |
| 268 | 277 |
| 269 TEST_F(MountHttpNodeTest, OpenAndClose) { | 278 TEST_F(MountHttpNodeTest, OpenAndCloseNoCache) { |
| 279 StringMap_t smap; | |
| 280 smap["cache_content"] = "false"; | |
| 270 SetMountArgs(StringMap_t()); | 281 SetMountArgs(StringMap_t()); |
| 271 ExpectOpen("HEAD"); | 282 ExpectOpen("HEAD"); |
| 272 ExpectHeaders(""); | 283 ExpectHeaders(""); |
| 273 SetResponse(200, ""); | 284 SetResponse(200, ""); |
| 274 OpenNode(); | 285 OpenNode(); |
| 275 } | 286 } |
| 276 | 287 |
| 277 TEST_F(MountHttpNodeTest, ReadCached) { | 288 TEST_F(MountHttpNodeTest, ReadCached) { |
| 289 size_t result_size = 0; | |
| 290 int result_bytes = 0; | |
| 291 | |
| 278 SetMountArgs(StringMap_t()); | 292 SetMountArgs(StringMap_t()); |
| 279 ExpectOpen("HEAD"); | 293 ExpectOpen("HEAD"); |
| 280 ExpectHeaders(""); | 294 ExpectHeaders(""); |
| 281 SetResponse(200, "Content-Length: 42\n"); | 295 SetResponse(200, "Content-Length: 42\n"); |
| 282 OpenNode(); | 296 OpenNode(); |
| 283 ResetMocks(); | 297 ResetMocks(); |
| 284 | 298 |
| 285 EXPECT_EQ(42, node_->GetSize()); | 299 EXPECT_EQ(0, node_->GetSize(&result_size)); |
| 300 EXPECT_EQ(42, result_size); | |
| 286 | 301 |
| 287 char buf[10]; | 302 char buf[10]; |
| 288 memset(&buf[0], 0, sizeof(buf)); | 303 memset(&buf[0], 0, sizeof(buf)); |
| 289 | 304 |
| 290 ExpectOpen("GET"); | 305 ExpectOpen("GET"); |
| 291 ExpectHeaders(""); | 306 ExpectHeaders(""); |
| 292 SetResponse(200, "Content-Length: 42\n"); | 307 SetResponse(200, "Content-Length: 42\n"); |
| 293 SetResponseBody("Here is some response text. And some more."); | 308 SetResponseBody("Here is some response text. And some more."); |
| 294 node_->Read(0, buf, sizeof(buf) - 1); | 309 EXPECT_EQ(0, node_->Read(0, buf, sizeof(buf) - 1, &result_bytes)); |
| 295 EXPECT_STREQ("Here is s", &buf[0]); | 310 EXPECT_STREQ("Here is s", &buf[0]); |
| 296 ResetMocks(); | 311 ResetMocks(); |
| 297 | 312 |
| 298 // Further reads should be cached. | 313 // Further reads should be cached. |
| 299 node_->Read(0, buf, sizeof(buf) - 1); | 314 EXPECT_EQ(0, node_->Read(0, buf, sizeof(buf) - 1, &result_bytes)); |
| 300 EXPECT_STREQ("Here is s", &buf[0]); | 315 EXPECT_STREQ("Here is s", &buf[0]); |
| 301 node_->Read(10, buf, sizeof(buf) - 1); | 316 EXPECT_EQ(0, node_->Read(10, buf, sizeof(buf) - 1, &result_bytes)); |
| 302 EXPECT_STREQ("me respon", &buf[0]); | 317 EXPECT_STREQ("me respon", &buf[0]); |
| 303 | 318 |
| 304 EXPECT_EQ(42, node_->GetSize()); | 319 EXPECT_EQ(0, node_->GetSize(&result_size)); |
| 320 EXPECT_EQ(42, result_size); | |
| 305 } | 321 } |
| 306 | 322 |
| 307 TEST_F(MountHttpNodeTest, ReadCachedNoContentLength) { | 323 TEST_F(MountHttpNodeTest, ReadCachedNoContentLength) { |
| 324 size_t result_size = 0; | |
| 325 int result_bytes = 0; | |
| 326 | |
| 308 SetMountArgs(StringMap_t()); | 327 SetMountArgs(StringMap_t()); |
| 309 ExpectOpen("HEAD"); | 328 ExpectOpen("HEAD"); |
| 310 ExpectHeaders(""); | 329 ExpectHeaders(""); |
| 311 SetResponse(200, ""); | 330 SetResponse(200, ""); |
| 312 OpenNode(); | 331 OpenNode(); |
| 313 ResetMocks(); | 332 ResetMocks(); |
| 314 | 333 |
| 315 ExpectOpen("GET"); | 334 ExpectOpen("GET"); |
| 316 ExpectHeaders(""); | 335 ExpectHeaders(""); |
| 317 SetResponse(200, ""); // No Content-Length response here. | 336 SetResponse(200, ""); // No Content-Length response here. |
| 318 SetResponseBody("Here is some response text. And some more."); | 337 SetResponseBody("Here is some response text. And some more."); |
| 319 | 338 |
| 320 // GetSize will Read() because it didn't get the content length from the HEAD | 339 // GetSize will Read() because it didn't get the content length from the HEAD |
| 321 // request. | 340 // request. |
| 322 EXPECT_EQ(42, node_->GetSize()); | 341 EXPECT_EQ(0, node_->GetSize(&result_size)); |
| 342 EXPECT_EQ(42, result_size); | |
| 323 | 343 |
| 324 char buf[10]; | 344 char buf[10]; |
| 325 memset(&buf[0], 0, sizeof(buf)); | 345 memset(&buf[0], 0, sizeof(buf)); |
| 326 | 346 |
| 327 node_->Read(0, buf, sizeof(buf) - 1); | 347 EXPECT_EQ(0, node_->Read(0, buf, sizeof(buf) - 1, &result_bytes)); |
| 328 EXPECT_STREQ("Here is s", &buf[0]); | 348 EXPECT_STREQ("Here is s", &buf[0]); |
| 329 ResetMocks(); | 349 ResetMocks(); |
| 330 | 350 |
| 331 // Further reads should be cached. | 351 // Further reads should be cached. |
| 332 node_->Read(0, buf, sizeof(buf) - 1); | 352 EXPECT_EQ(0, node_->Read(0, buf, sizeof(buf) - 1, &result_bytes)); |
| 333 EXPECT_STREQ("Here is s", &buf[0]); | 353 EXPECT_STREQ("Here is s", &buf[0]); |
| 334 node_->Read(10, buf, sizeof(buf) - 1); | 354 EXPECT_EQ(0, node_->Read(10, buf, sizeof(buf) - 1, &result_bytes)); |
| 335 EXPECT_STREQ("me respon", &buf[0]); | 355 EXPECT_STREQ("me respon", &buf[0]); |
| 336 | 356 |
| 337 EXPECT_EQ(42, node_->GetSize()); | 357 EXPECT_EQ(0, node_->GetSize(&result_size)); |
| 358 EXPECT_EQ(42, result_size); | |
| 338 } | 359 } |
| 339 | 360 |
| 340 TEST_F(MountHttpNodeTest, ReadCachedUnderrun) { | 361 TEST_F(MountHttpNodeTest, ReadCachedUnderrun) { |
| 362 size_t result_size = 0; | |
| 363 int result_bytes = 0; | |
| 364 | |
| 341 SetMountArgs(StringMap_t()); | 365 SetMountArgs(StringMap_t()); |
| 342 ExpectOpen("HEAD"); | 366 ExpectOpen("HEAD"); |
| 343 ExpectHeaders(""); | 367 ExpectHeaders(""); |
| 344 SetResponse(200, "Content-Length: 100\n"); | 368 SetResponse(200, "Content-Length: 100\n"); |
| 345 OpenNode(); | 369 OpenNode(); |
| 346 ResetMocks(); | 370 ResetMocks(); |
| 347 | 371 |
| 348 EXPECT_EQ(100, node_->GetSize()); | 372 EXPECT_EQ(0, node_->GetSize(&result_size)); |
| 373 EXPECT_EQ(100, result_size); | |
| 349 | 374 |
| 350 char buf[10]; | 375 char buf[10]; |
| 351 memset(&buf[0], 0, sizeof(buf)); | 376 memset(&buf[0], 0, sizeof(buf)); |
| 352 | 377 |
| 353 ExpectOpen("GET"); | 378 ExpectOpen("GET"); |
| 354 ExpectHeaders(""); | 379 ExpectHeaders(""); |
| 355 SetResponse(200, "Content-Length: 100\n"); | 380 SetResponse(200, "Content-Length: 100\n"); |
| 356 SetResponseBody("abcdefghijklmnopqrstuvwxyz"); | 381 SetResponseBody("abcdefghijklmnopqrstuvwxyz"); |
| 357 node_->Read(0, buf, sizeof(buf) - 1); | 382 EXPECT_EQ(0, node_->Read(0, buf, sizeof(buf) - 1, &result_bytes)); |
|
noelallen1
2013/06/07 21:48:43
Set but not compared?
binji
2013/06/07 23:23:11
Done.
| |
| 358 EXPECT_STREQ("abcdefghi", &buf[0]); | 383 EXPECT_STREQ("abcdefghi", &buf[0]); |
| 359 ResetMocks(); | 384 ResetMocks(); |
| 360 | 385 |
| 361 EXPECT_EQ(26, node_->GetSize()); | 386 EXPECT_EQ(0, node_->GetSize(&result_size)); |
| 387 EXPECT_EQ(26, result_size); | |
| 362 } | 388 } |
| 363 | 389 |
| 364 TEST_F(MountHttpNodeTest, ReadCachedOverrun) { | 390 TEST_F(MountHttpNodeTest, ReadCachedOverrun) { |
| 391 size_t result_size = 0; | |
| 392 int result_bytes = 0; | |
| 393 | |
| 365 SetMountArgs(StringMap_t()); | 394 SetMountArgs(StringMap_t()); |
| 366 ExpectOpen("HEAD"); | 395 ExpectOpen("HEAD"); |
| 367 ExpectHeaders(""); | 396 ExpectHeaders(""); |
| 368 SetResponse(200, "Content-Length: 15\n"); | 397 SetResponse(200, "Content-Length: 15\n"); |
| 369 OpenNode(); | 398 OpenNode(); |
| 370 ResetMocks(); | 399 ResetMocks(); |
| 371 | 400 |
| 372 EXPECT_EQ(15, node_->GetSize()); | 401 EXPECT_EQ(0, node_->GetSize(&result_size)); |
| 402 EXPECT_EQ(15, result_size); | |
| 373 | 403 |
| 374 char buf[10]; | 404 char buf[10]; |
| 375 memset(&buf[0], 0, sizeof(buf)); | 405 memset(&buf[0], 0, sizeof(buf)); |
| 376 | 406 |
| 377 ExpectOpen("GET"); | 407 ExpectOpen("GET"); |
| 378 ExpectHeaders(""); | 408 ExpectHeaders(""); |
| 379 SetResponse(200, "Content-Length: 15\n"); | 409 SetResponse(200, "Content-Length: 15\n"); |
| 380 SetResponseBody("01234567890123456789"); | 410 SetResponseBody("01234567890123456789"); |
| 381 node_->Read(10, buf, sizeof(buf) - 1); | 411 EXPECT_EQ(0, node_->Read(10, buf, sizeof(buf) - 1, &result_bytes)); |
|
noelallen1
2013/06/07 21:48:43
result_butes set but not compared?
binji
2013/06/07 23:23:11
Done.
| |
| 382 EXPECT_STREQ("01234", &buf[0]); | 412 EXPECT_STREQ("01234", &buf[0]); |
| 383 ResetMocks(); | 413 ResetMocks(); |
| 384 | 414 |
| 385 EXPECT_EQ(15, node_->GetSize()); | 415 EXPECT_EQ(0, node_->GetSize(&result_size)); |
| 416 EXPECT_EQ(15, result_size); | |
| 386 } | 417 } |
| 387 | 418 |
| 388 TEST_F(MountHttpNodeTest, ReadPartial) { | 419 TEST_F(MountHttpNodeTest, ReadPartial) { |
| 420 size_t result_size = 0; | |
|
noelallen1
2013/06/07 21:48:43
unused?
binji
2013/06/07 23:23:11
Done.
| |
| 421 int result_bytes = 0; | |
| 422 | |
| 389 StringMap_t args; | 423 StringMap_t args; |
| 390 args["cache_content"] = "false"; | 424 args["cache_content"] = "false"; |
| 391 SetMountArgs(args); | 425 SetMountArgs(args); |
| 392 ExpectOpen("HEAD"); | 426 ExpectOpen("HEAD"); |
| 393 ExpectHeaders(""); | 427 ExpectHeaders(""); |
| 394 SetResponse(200, ""); | 428 SetResponse(200, ""); |
| 395 OpenNode(); | 429 OpenNode(); |
| 396 ResetMocks(); | 430 ResetMocks(); |
| 397 | 431 |
| 398 char buf[10]; | 432 char buf[10]; |
| 399 memset(&buf[0], 0, sizeof(buf)); | 433 memset(&buf[0], 0, sizeof(buf)); |
| 400 | 434 |
| 401 ExpectOpen("GET"); | 435 ExpectOpen("GET"); |
| 402 ExpectHeaders("Range: bytes=0-8\n"); | 436 ExpectHeaders("Range: bytes=0-8\n"); |
| 403 SetResponse(206, "Content-Length: 9\nContent-Range: bytes=0-8\n"); | 437 SetResponse(206, "Content-Length: 9\nContent-Range: bytes=0-8\n"); |
| 404 SetResponseBody("012345678"); | 438 SetResponseBody("012345678"); |
| 405 node_->Read(0, buf, sizeof(buf) - 1); | 439 EXPECT_EQ(0, node_->Read(0, buf, sizeof(buf) - 1, &result_bytes)); |
| 406 EXPECT_STREQ("012345678", &buf[0]); | 440 EXPECT_STREQ("012345678", &buf[0]); |
| 407 ResetMocks(); | 441 ResetMocks(); |
| 408 | 442 |
| 409 // Another read is another request. | 443 // Another read is another request. |
| 410 ExpectOpen("GET"); | 444 ExpectOpen("GET"); |
| 411 ExpectHeaders("Range: bytes=10-18\n"); | 445 ExpectHeaders("Range: bytes=10-18\n"); |
| 412 SetResponse(206, "Content-Length: 9\nContent-Range: bytes=10-18\n"); | 446 SetResponse(206, "Content-Length: 9\nContent-Range: bytes=10-18\n"); |
| 413 SetResponseBody("abcdefghi"); | 447 SetResponseBody("abcdefghi"); |
| 414 node_->Read(10, buf, sizeof(buf) - 1); | 448 EXPECT_EQ(0, node_->Read(10, buf, sizeof(buf) - 1, &result_bytes)); |
| 415 EXPECT_STREQ("abcdefghi", &buf[0]); | 449 EXPECT_STREQ("abcdefghi", &buf[0]); |
| 416 } | 450 } |
| 417 | 451 |
| 418 TEST_F(MountHttpNodeTest, ReadPartialNoServerSupport) { | 452 TEST_F(MountHttpNodeTest, ReadPartialNoServerSupport) { |
| 453 size_t result_size = 0; | |
|
noelallen1
2013/06/07 21:48:43
unused?
binji
2013/06/07 23:23:11
Done.
| |
| 454 int result_bytes = 0; | |
| 455 | |
| 419 StringMap_t args; | 456 StringMap_t args; |
| 420 args["cache_content"] = "false"; | 457 args["cache_content"] = "false"; |
| 421 SetMountArgs(args); | 458 SetMountArgs(args); |
| 422 ExpectOpen("HEAD"); | 459 ExpectOpen("HEAD"); |
| 423 ExpectHeaders(""); | 460 ExpectHeaders(""); |
| 424 SetResponse(200, ""); | 461 SetResponse(200, ""); |
| 425 OpenNode(); | 462 OpenNode(); |
| 426 ResetMocks(); | 463 ResetMocks(); |
| 427 | 464 |
| 428 char buf[10]; | 465 char buf[10]; |
| 429 memset(&buf[0], 0, sizeof(buf)); | 466 memset(&buf[0], 0, sizeof(buf)); |
| 430 | 467 |
| 431 ExpectOpen("GET"); | 468 ExpectOpen("GET"); |
| 432 ExpectHeaders("Range: bytes=10-18\n"); | 469 ExpectHeaders("Range: bytes=10-18\n"); |
| 433 SetResponse(200, "Content-Length: 20\n"); | 470 SetResponse(200, "Content-Length: 20\n"); |
| 434 SetResponseBody("0123456789abcdefghij"); | 471 SetResponseBody("0123456789abcdefghij"); |
| 435 node_->Read(10, buf, sizeof(buf) - 1); | 472 EXPECT_EQ(0, node_->Read(10, buf, sizeof(buf) - 1, &result_bytes)); |
| 436 EXPECT_STREQ("abcdefghi", &buf[0]); | 473 EXPECT_STREQ("abcdefghi", &buf[0]); |
| 437 } | 474 } |
| OLD | NEW |