Remove unused code calling WebMediaPlayerClient::requestFullscreen()
[chromium-blink-merge.git] / content / test / fileapi_test_file_set.cc
blobf8e14e67a86a429287bb14e06efa5919e0d188f8
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/test/fileapi_test_file_set.h"
7 #include <string>
9 #include "base/files/file.h"
10 #include "base/files/file_util.h"
11 #include "base/logging.h"
12 #include "base/rand_util.h"
13 #include "testing/gtest/include/gtest/gtest.h"
15 namespace content {
17 const FileSystemTestCaseRecord kRegularFileSystemTestCases[] = {
18 {true, FILE_PATH_LITERAL("dir a"), 0},
19 {true, FILE_PATH_LITERAL("dir a/dir A"), 0},
20 {true, FILE_PATH_LITERAL("dir a/dir d"), 0},
21 {true, FILE_PATH_LITERAL("dir a/dir d/dir e"), 0},
22 {true, FILE_PATH_LITERAL("dir a/dir d/dir e/dir f"), 0},
23 {true, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g"), 0},
24 {true, FILE_PATH_LITERAL("dir a/dir d/dir e/dir h"), 0},
25 {true, FILE_PATH_LITERAL("dir b"), 0},
26 {true, FILE_PATH_LITERAL("dir b/dir a"), 0},
27 {true, FILE_PATH_LITERAL("dir c"), 0},
28 {false, FILE_PATH_LITERAL("file 0"), 38},
29 {false, FILE_PATH_LITERAL("file 2"), 60},
30 {false, FILE_PATH_LITERAL("file 3"), 0},
31 {false, FILE_PATH_LITERAL("dir a/file 0"), 39},
32 {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 0"), 40},
33 {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 1"), 41},
34 {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 2"), 42},
35 {false, FILE_PATH_LITERAL("dir a/dir d/dir e/dir g/file 3"), 50},
38 const size_t kRegularFileSystemTestCaseSize =
39 arraysize(kRegularFileSystemTestCases);
41 void SetUpOneFileSystemTestCase(const base::FilePath& root_path,
42 const FileSystemTestCaseRecord& test_case) {
43 base::FilePath path = root_path.Append(test_case.path);
44 if (test_case.is_directory) {
45 ASSERT_TRUE(base::CreateDirectory(path));
46 return;
48 base::File file(path,
49 base::File::FLAG_CREATE_ALWAYS | base::File::FLAG_WRITE);
50 ASSERT_TRUE(file.IsValid());
51 if (test_case.data_file_size) {
52 std::string content = base::RandBytesAsString(test_case.data_file_size);
53 EXPECT_LE(test_case.data_file_size, kint32max);
54 ASSERT_EQ(static_cast<int>(content.size()),
55 file.Write(0, content.data(), static_cast<int>(content.size())));
60 void SetUpRegularFileSystemTestCases(const base::FilePath& root_path) {
61 for (size_t i = 0; i < arraysize(kRegularFileSystemTestCases); ++i) {
62 SCOPED_TRACE(testing::Message() << "Creating kRegularTestCases " << i);
63 SetUpOneFileSystemTestCase(root_path, kRegularFileSystemTestCases[i]);
67 } // namespace content