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