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/files/file_enumerator.h" | 7 #include "base/files/file_enumerator.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 const base::FilePath pref_template_path(user_data_dir(). | 112 const base::FilePath pref_template_path(user_data_dir(). |
113 AppendASCII("Default"). | 113 AppendASCII("Default"). |
114 AppendASCII("PreferencesTemplate")); | 114 AppendASCII("PreferencesTemplate")); |
115 const base::FilePath pref_path(user_data_dir(). | 115 const base::FilePath pref_path(user_data_dir(). |
116 AppendASCII(TestingProfile::kTestUserProfileDir). | 116 AppendASCII(TestingProfile::kTestUserProfileDir). |
117 AppendASCII("Preferences")); | 117 AppendASCII("Preferences")); |
118 | 118 |
119 // Read in preferences template. | 119 // Read in preferences template. |
120 std::string pref_string; | 120 std::string pref_string; |
121 EXPECT_TRUE(base::ReadFileToString(pref_template_path, &pref_string)); | 121 EXPECT_TRUE(base::ReadFileToString(pref_template_path, &pref_string)); |
122 string16 format_string = ASCIIToUTF16(pref_string); | 122 base::string16 format_string = ASCIIToUTF16(pref_string); |
123 | 123 |
124 // Make sure temp directory has the proper format for writing to prefs file. | 124 // Make sure temp directory has the proper format for writing to prefs file. |
125 #if defined(OS_POSIX) | 125 #if defined(OS_POSIX) |
126 std::wstring user_data_dir_w(ASCIIToWide(user_data_dir().value())); | 126 std::wstring user_data_dir_w(ASCIIToWide(user_data_dir().value())); |
127 #elif defined(OS_WIN) | 127 #elif defined(OS_WIN) |
128 std::wstring user_data_dir_w(user_data_dir().value()); | 128 std::wstring user_data_dir_w(user_data_dir().value()); |
129 // In Windows, the FilePath will write '\' for the path separators; change | 129 // In Windows, the FilePath will write '\' for the path separators; change |
130 // these to a separator that won't trigger escapes. | 130 // these to a separator that won't trigger escapes. |
131 std::replace(user_data_dir_w.begin(), | 131 std::replace(user_data_dir_w.begin(), |
132 user_data_dir_w.end(), '\\', '/'); | 132 user_data_dir_w.end(), '\\', '/'); |
133 #endif | 133 #endif |
134 | 134 |
135 // Rewrite prefs file. | 135 // Rewrite prefs file. |
136 std::vector<string16> subst; | 136 std::vector<base::string16> subst; |
137 subst.push_back(WideToUTF16(user_data_dir_w)); | 137 subst.push_back(WideToUTF16(user_data_dir_w)); |
138 const std::string prefs_string = | 138 const std::string prefs_string = |
139 UTF16ToASCII(ReplaceStringPlaceholders(format_string, subst, NULL)); | 139 UTF16ToASCII(ReplaceStringPlaceholders(format_string, subst, NULL)); |
140 EXPECT_TRUE(file_util::WriteFile(pref_path, prefs_string.c_str(), | 140 EXPECT_TRUE(file_util::WriteFile(pref_path, prefs_string.c_str(), |
141 prefs_string.size())); | 141 prefs_string.size())); |
142 file_util::EvictFileFromSystemCache(pref_path); | 142 file_util::EvictFileFromSystemCache(pref_path); |
143 } | 143 } |
144 | 144 |
145 // Runs a test which loads |tab_count| tabs on startup, either as command line | 145 // Runs a test which loads |tab_count| tabs on startup, either as command line |
146 // arguments or, if |restore_session| is true, by using session restore. | 146 // arguments or, if |restore_session| is true, by using session restore. |
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 } | 473 } |
474 | 474 |
475 TEST_F(StartupTest, ProfilingScript1) { | 475 TEST_F(StartupTest, ProfilingScript1) { |
476 SetUpWithFileURL(); | 476 SetUpWithFileURL(); |
477 SetUpWithProfiling(); | 477 SetUpWithProfiling(); |
478 RunStartupTest("warm", "profiling_scripts1", WARM, NOT_IMPORTANT, | 478 RunStartupTest("warm", "profiling_scripts1", WARM, NOT_IMPORTANT, |
479 PerfUITestSuite::DEFAULT_THEME, 1, 0); | 479 PerfUITestSuite::DEFAULT_THEME, 1, 0); |
480 } | 480 } |
481 | 481 |
482 } // namespace | 482 } // namespace |
OLD | NEW |