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 <fcntl.h> | 5 #include <fcntl.h> |
6 #include <gmock/gmock.h> | 6 #include <gmock/gmock.h> |
7 #include <ppapi/c/ppb_file_io.h> | 7 #include <ppapi/c/ppb_file_io.h> |
8 #include <ppapi/c/pp_errors.h> | 8 #include <ppapi/c/pp_errors.h> |
9 #include <ppapi/c/pp_instance.h> | 9 #include <ppapi/c/pp_instance.h> |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 ASSERT_EQ(0, mnt_.Access(Path("/foo"), R_OK)); | 79 ASSERT_EQ(0, mnt_.Access(Path("/foo"), R_OK)); |
80 ASSERT_EQ(EACCES, mnt_.Access(Path("/foo"), W_OK)); | 80 ASSERT_EQ(EACCES, mnt_.Access(Path("/foo"), W_OK)); |
81 ASSERT_EQ(EACCES, mnt_.Access(Path("/foo"), X_OK)); | 81 ASSERT_EQ(EACCES, mnt_.Access(Path("/foo"), X_OK)); |
82 ASSERT_EQ(ENOENT, mnt_.Access(Path("/bar"), F_OK)); | 82 ASSERT_EQ(ENOENT, mnt_.Access(Path("/bar"), F_OK)); |
83 } | 83 } |
84 | 84 |
85 TEST_P(MountHttpTest, OpenAndCloseServerError) { | 85 TEST_P(MountHttpTest, OpenAndCloseServerError) { |
86 EXPECT_TRUE(ppapi_.server_template()->AddError("file", 500)); | 86 EXPECT_TRUE(ppapi_.server_template()->AddError("file", 500)); |
87 | 87 |
88 ScopedMountNode node; | 88 ScopedMountNode node; |
89 ASSERT_EQ(ENOENT, mnt_.Open(Path("/file"), O_RDONLY, &node)); | 89 ASSERT_EQ(EIO, mnt_.Open(Path("/file"), O_RDONLY, &node)); |
90 } | 90 } |
91 | 91 |
92 TEST_P(MountHttpTest, ReadPartial) { | 92 TEST_P(MountHttpTest, ReadPartial) { |
93 const char contents[] = "0123456789abcdefg"; | 93 const char contents[] = "0123456789abcdefg"; |
94 ASSERT_TRUE(ppapi_.server_template()->AddEntity("file", contents, NULL)); | 94 ASSERT_TRUE(ppapi_.server_template()->AddEntity("file", contents, NULL)); |
95 ppapi_.server_template()->set_allow_partial(true); | 95 ppapi_.server_template()->set_allow_partial(true); |
96 | 96 |
97 int result_bytes = 0; | 97 int result_bytes = 0; |
98 | 98 |
99 char buf[10]; | 99 char buf[10]; |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 | 290 |
291 EXPECT_FALSE(foo->GetStat(&sfoo)); | 291 EXPECT_FALSE(foo->GetStat(&sfoo)); |
292 EXPECT_FALSE(bar->GetStat(&sbar)); | 292 EXPECT_FALSE(bar->GetStat(&sbar)); |
293 | 293 |
294 EXPECT_EQ(123, sfoo.st_size); | 294 EXPECT_EQ(123, sfoo.st_size); |
295 EXPECT_EQ(S_IFREG | S_IRALL, sfoo.st_mode); | 295 EXPECT_EQ(S_IFREG | S_IRALL, sfoo.st_mode); |
296 | 296 |
297 EXPECT_EQ(234, sbar.st_size); | 297 EXPECT_EQ(234, sbar.st_size); |
298 EXPECT_EQ(S_IFREG | S_IRALL | S_IWALL, sbar.st_mode); | 298 EXPECT_EQ(S_IFREG | S_IRALL | S_IWALL, sbar.st_mode); |
299 } | 299 } |
OLD | NEW |