OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 // TODO(binji): If the server doesn't send the content length, this operation | 236 // TODO(binji): If the server doesn't send the content length, this operation |
237 // will be incredibly slow; it will attempt to read all of the data from the | 237 // will be incredibly slow; it will attempt to read all of the data from the |
238 // server to find the file length. Can we do anything smarter? | 238 // server to find the file length. Can we do anything smarter? |
239 ppapi_.server_template()->set_send_content_length(true); | 239 ppapi_.server_template()->set_send_content_length(true); |
240 | 240 |
241 ScopedNode node; | 241 ScopedNode node; |
242 ASSERT_EQ(0, fs_.Open(Path("/file"), O_RDONLY, &node)); | 242 ASSERT_EQ(0, fs_.Open(Path("/file"), O_RDONLY, &node)); |
243 | 243 |
244 struct stat statbuf; | 244 struct stat statbuf; |
245 EXPECT_EQ(0, node->GetStat(&statbuf)); | 245 EXPECT_EQ(0, node->GetStat(&statbuf)); |
246 EXPECT_EQ(S_IFREG | S_IRUSR | S_IRGRP | S_IROTH, statbuf.st_mode); | 246 EXPECT_TRUE(S_ISREG(statbuf.st_mode)); |
| 247 EXPECT_EQ(S_IRUSR | S_IRGRP | S_IROTH, statbuf.st_mode & 0777); |
247 EXPECT_EQ(size, statbuf.st_size); | 248 EXPECT_EQ(size, statbuf.st_size); |
248 // These are not currently set. | 249 // These are not currently set. |
249 EXPECT_EQ(0, statbuf.st_atime); | 250 EXPECT_EQ(0, statbuf.st_atime); |
250 EXPECT_EQ(0, statbuf.st_ctime); | 251 EXPECT_EQ(0, statbuf.st_ctime); |
251 EXPECT_EQ(0, statbuf.st_mtime); | 252 EXPECT_EQ(0, statbuf.st_mtime); |
252 } | 253 } |
253 | 254 |
254 // Instantiate the large file tests, only when cache content is off. | 255 // Instantiate the large file tests, only when cache content is off. |
255 // TODO(binji): make cache content smarter, so it doesn't try to cache enormous | 256 // TODO(binji): make cache content smarter, so it doesn't try to cache enormous |
256 // files. See http://crbug.com/369279. | 257 // files. See http://crbug.com/369279. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 // Check access to blob file | 391 // Check access to blob file |
391 ASSERT_EQ(0, fs.Open(Path("/"), O_RDONLY, &node)); | 392 ASSERT_EQ(0, fs.Open(Path("/"), O_RDONLY, &node)); |
392 ASSERT_EQ(true, node->IsaFile()); | 393 ASSERT_EQ(true, node->IsaFile()); |
393 | 394 |
394 // Verify file size and permissions | 395 // Verify file size and permissions |
395 struct stat buf; | 396 struct stat buf; |
396 ASSERT_EQ(0, node->GetStat(&buf)); | 397 ASSERT_EQ(0, node->GetStat(&buf)); |
397 ASSERT_EQ(S_IRUSR, buf.st_mode & S_IRWXU); | 398 ASSERT_EQ(S_IRUSR, buf.st_mode & S_IRWXU); |
398 ASSERT_EQ(strlen(kContent), buf.st_size); | 399 ASSERT_EQ(strlen(kContent), buf.st_size); |
399 } | 400 } |
OLD | NEW |