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/environment.h" | 5 #include "base/environment.h" |
6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 AppendASCII(TestingProfile::kTestUserProfileDir). | 112 AppendASCII(TestingProfile::kTestUserProfileDir). |
113 AppendASCII("Preferences")); | 113 AppendASCII("Preferences")); |
114 | 114 |
115 // Read in preferences template. | 115 // Read in preferences template. |
116 std::string pref_string; | 116 std::string pref_string; |
117 EXPECT_TRUE(file_util::ReadFileToString(pref_template_path, &pref_string)); | 117 EXPECT_TRUE(file_util::ReadFileToString(pref_template_path, &pref_string)); |
118 string16 format_string = ASCIIToUTF16(pref_string); | 118 string16 format_string = ASCIIToUTF16(pref_string); |
119 | 119 |
120 // Make sure temp directory has the proper format for writing to prefs file. | 120 // Make sure temp directory has the proper format for writing to prefs file. |
121 #if defined(OS_POSIX) | 121 #if defined(OS_POSIX) |
122 std::wstring user_data_dir_w(ASCIIToWide(user_data_dir().value())); | 122 std::wstring user_data_dir_w(base::ASCIIToWide(user_data_dir().value())); |
123 #elif defined(OS_WIN) | 123 #elif defined(OS_WIN) |
124 std::wstring user_data_dir_w(user_data_dir().value()); | 124 std::wstring user_data_dir_w(user_data_dir().value()); |
125 // In Windows, the FilePath will write '\' for the path separators; change | 125 // In Windows, the FilePath will write '\' for the path separators; change |
126 // these to a separator that won't trigger escapes. | 126 // these to a separator that won't trigger escapes. |
127 std::replace(user_data_dir_w.begin(), | 127 std::replace(user_data_dir_w.begin(), |
128 user_data_dir_w.end(), '\\', '/'); | 128 user_data_dir_w.end(), '\\', '/'); |
129 #endif | 129 #endif |
130 | 130 |
131 // Rewrite prefs file. | 131 // Rewrite prefs file. |
132 std::vector<string16> subst; | 132 std::vector<string16> subst; |
133 subst.push_back(WideToUTF16(user_data_dir_w)); | 133 subst.push_back(base::WideToUTF16(user_data_dir_w)); |
134 const std::string prefs_string = | 134 const std::string prefs_string = |
135 UTF16ToASCII(ReplaceStringPlaceholders(format_string, subst, NULL)); | 135 UTF16ToASCII(ReplaceStringPlaceholders(format_string, subst, NULL)); |
136 EXPECT_TRUE(file_util::WriteFile(pref_path, prefs_string.c_str(), | 136 EXPECT_TRUE(file_util::WriteFile(pref_path, prefs_string.c_str(), |
137 prefs_string.size())); | 137 prefs_string.size())); |
138 file_util::EvictFileFromSystemCache(pref_path); | 138 file_util::EvictFileFromSystemCache(pref_path); |
139 } | 139 } |
140 | 140 |
141 // Runs a test which loads |tab_count| tabs on startup, either as command line | 141 // Runs a test which loads |tab_count| tabs on startup, either as command line |
142 // arguments or, if |restore_session| is true, by using session restore. | 142 // arguments or, if |restore_session| is true, by using session restore. |
143 // |nth_timed_tab|, if non-zero, will measure time to load the first n+1 tabs. | 143 // |nth_timed_tab|, if non-zero, will measure time to load the first n+1 tabs. |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 } | 463 } |
464 | 464 |
465 TEST_F(StartupTest, ProfilingScript1) { | 465 TEST_F(StartupTest, ProfilingScript1) { |
466 SetUpWithFileURL(); | 466 SetUpWithFileURL(); |
467 SetUpWithProfiling(); | 467 SetUpWithProfiling(); |
468 RunStartupTest("warm", "profiling_scripts1", WARM, NOT_IMPORTANT, | 468 RunStartupTest("warm", "profiling_scripts1", WARM, NOT_IMPORTANT, |
469 UITestBase::DEFAULT_THEME, 1, 0); | 469 UITestBase::DEFAULT_THEME, 1, 0); |
470 } | 470 } |
471 | 471 |
472 } // namespace | 472 } // namespace |
OLD | NEW |