Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(350)

Side by Side Diff: chrome/test/perf/startup_test.cc

Issue 12314090: Add utf_string_conversions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/perf/page_cycler_test.cc ('k') | chrome/test/perf/tab_switching_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/test/perf/page_cycler_test.cc ('k') | chrome/test/perf/tab_switching_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698