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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_enumerator.h" |
8 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
9 #include "base/path_service.h" | 10 #include "base/path_service.h" |
10 #include "base/process_util.h" | 11 #include "base/process_util.h" |
11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
13 #include "base/strings/sys_string_conversions.h" | 14 #include "base/strings/sys_string_conversions.h" |
14 #include "base/test/test_timeouts.h" | 15 #include "base/test/test_timeouts.h" |
15 #include "base/utf_string_conversions.h" | 16 #include "base/utf_string_conversions.h" |
16 #include "chrome/browser/net/url_fixer_upper.h" | 17 #include "chrome/browser/net/url_fixer_upper.h" |
17 #include "chrome/common/chrome_constants.h" | 18 #include "chrome/common/chrome_constants.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 // into the cache we equalize the tests for comparing timing data. | 62 // into the cache we equalize the tests for comparing timing data. |
62 | 63 |
63 // We don't want to walk into .svn dirs, so we have to do the tree walk | 64 // We don't want to walk into .svn dirs, so we have to do the tree walk |
64 // ourselves. | 65 // ourselves. |
65 | 66 |
66 std::vector<base::FilePath> dirs; | 67 std::vector<base::FilePath> dirs; |
67 dirs.push_back(test_dir); | 68 dirs.push_back(test_dir); |
68 const base::FilePath svn_dir(FILE_PATH_LITERAL(".svn")); | 69 const base::FilePath svn_dir(FILE_PATH_LITERAL(".svn")); |
69 | 70 |
70 for (size_t idx = 0; idx < dirs.size(); ++idx) { | 71 for (size_t idx = 0; idx < dirs.size(); ++idx) { |
71 file_util::FileEnumerator dir_enumerator(dirs[idx], false, | 72 base::FileEnumerator dir_enumerator(dirs[idx], false, |
72 file_util::FileEnumerator::DIRECTORIES); | 73 base::FileEnumerator::DIRECTORIES); |
73 base::FilePath path; | 74 base::FilePath path; |
74 for (path = dir_enumerator.Next(); | 75 for (path = dir_enumerator.Next(); |
75 !path.empty(); | 76 !path.empty(); |
76 path = dir_enumerator.Next()) { | 77 path = dir_enumerator.Next()) { |
77 if (path.BaseName() != svn_dir) | 78 if (path.BaseName() != svn_dir) |
78 dirs.push_back(path); | 79 dirs.push_back(path); |
79 } | 80 } |
80 } | 81 } |
81 | 82 |
82 unsigned int loaded = 0; | 83 unsigned int loaded = 0; |
83 | 84 |
84 // We seem to have some files in the data dirs that are just there for | 85 // We seem to have some files in the data dirs that are just there for |
85 // reference, make a quick attempt to skip them by matching suffixes. | 86 // reference, make a quick attempt to skip them by matching suffixes. |
86 std::vector<base::FilePath::StringType> ignore_suffixes; | 87 std::vector<base::FilePath::StringType> ignore_suffixes; |
87 ignore_suffixes.push_back(FILE_PATH_LITERAL(".orig.html")); | 88 ignore_suffixes.push_back(FILE_PATH_LITERAL(".orig.html")); |
88 ignore_suffixes.push_back(FILE_PATH_LITERAL(".html-original")); | 89 ignore_suffixes.push_back(FILE_PATH_LITERAL(".html-original")); |
89 | 90 |
90 std::vector<base::FilePath>::const_iterator iter; | 91 std::vector<base::FilePath>::const_iterator iter; |
91 for (iter = dirs.begin(); iter != dirs.end(); ++iter) { | 92 for (iter = dirs.begin(); iter != dirs.end(); ++iter) { |
92 file_util::FileEnumerator file_enumerator(*iter, false, | 93 base::FileEnumerator file_enumerator(*iter, false, |
93 file_util::FileEnumerator::FILES); | 94 base::FileEnumerator::FILES); |
94 base::FilePath path; | 95 base::FilePath path; |
95 for (path = file_enumerator.Next(); | 96 for (path = file_enumerator.Next(); |
96 !path.empty(); | 97 !path.empty(); |
97 path = file_enumerator.Next()) { | 98 path = file_enumerator.Next()) { |
98 const base::FilePath base_name = path.BaseName(); | 99 const base::FilePath base_name = path.BaseName(); |
99 const size_t base_name_size = base_name.value().size(); | 100 const size_t base_name_size = base_name.value().size(); |
100 | 101 |
101 bool should_skip = false; | 102 bool should_skip = false; |
102 std::vector<base::FilePath::StringType>::const_iterator ignore_iter; | 103 std::vector<base::FilePath::StringType>::const_iterator ignore_iter; |
103 for (ignore_iter = ignore_suffixes.begin(); | 104 for (ignore_iter = ignore_suffixes.begin(); |
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
678 TEST_F(PageCyclerAccessibilityTest, MozFileWithAccessibilityEnabled) { | 679 TEST_F(PageCyclerAccessibilityTest, MozFileWithAccessibilityEnabled) { |
679 num_test_iterations_ = 1; | 680 num_test_iterations_ = 1; |
680 RunTest("times", "moz", false); | 681 RunTest("times", "moz", false); |
681 } | 682 } |
682 | 683 |
683 TEST_F(PageCyclerAccessibilityTest, MorejsFileWithAccessibilityEnabled) { | 684 TEST_F(PageCyclerAccessibilityTest, MorejsFileWithAccessibilityEnabled) { |
684 RunTest("times", "morejs", false); | 685 RunTest("times", "morejs", false); |
685 } | 686 } |
686 | 687 |
687 } // namespace | 688 } // namespace |
OLD | NEW |