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> |
11 #include <sys/stat.h> | 11 #include <sys/stat.h> |
12 #include <sys/types.h> | 12 #include <sys/types.h> |
13 | 13 |
14 #include "mock_util.h" | 14 #include "mock_util.h" |
15 #include "nacl_io/kernel_intercept.h" | 15 #include "nacl_io/kernel_intercept.h" |
16 #include "nacl_io/mount_http.h" | 16 #include "nacl_io/mount_http.h" |
17 #include "nacl_io/mount_node_dir.h" | 17 #include "nacl_io/mount_node_dir.h" |
18 #include "nacl_io/osdirent.h" | 18 #include "nacl_io/osdirent.h" |
19 #include "nacl_io/osunistd.h" | 19 #include "nacl_io/osunistd.h" |
20 #include "pepper_interface_mock.h" | 20 #include "pepper_interface_mock.h" |
21 | 21 |
| 22 using namespace nacl_io; |
| 23 |
22 using ::testing::_; | 24 using ::testing::_; |
23 using ::testing::DoAll; | 25 using ::testing::DoAll; |
24 using ::testing::Mock; | 26 using ::testing::Mock; |
25 using ::testing::Return; | 27 using ::testing::Return; |
26 using ::testing::SetArgPointee; | 28 using ::testing::SetArgPointee; |
27 using ::testing::StrEq; | 29 using ::testing::StrEq; |
28 | 30 |
29 | 31 |
30 class MountHttpMock : public MountHttp { | 32 class MountHttpMock : public MountHttp { |
31 public: | 33 public: |
(...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
601 | 603 |
602 ExpectOpen("GET"); | 604 ExpectOpen("GET"); |
603 ExpectHeaders("Range: bytes=10-18\n"); | 605 ExpectHeaders("Range: bytes=10-18\n"); |
604 SetResponse(200, "Content-Length: 20\n"); | 606 SetResponse(200, "Content-Length: 20\n"); |
605 SetResponseBody("0123456789abcdefghij"); | 607 SetResponseBody("0123456789abcdefghij"); |
606 EXPECT_EQ(0, node_->Read(10, buf, sizeof(buf) - 1, &result_bytes)); | 608 EXPECT_EQ(0, node_->Read(10, buf, sizeof(buf) - 1, &result_bytes)); |
607 EXPECT_EQ(sizeof(buf) - 1, result_bytes); | 609 EXPECT_EQ(sizeof(buf) - 1, result_bytes); |
608 EXPECT_STREQ("abcdefghi", &buf[0]); | 610 EXPECT_STREQ("abcdefghi", &buf[0]); |
609 } | 611 } |
610 | 612 |
OLD | NEW |