OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/test/perf/perf_ui_test_suite.h" | 5 #include "chrome/test/perf/perf_ui_test_suite.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/json/json_file_value_serializer.h" | 8 #include "base/json/json_file_value_serializer.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 if (!GenerateProfile(TOP_SITES, kNumURLs, default_path)) { | 94 if (!GenerateProfile(TOP_SITES, kNumURLs, default_path)) { |
95 LOG(FATAL) << "Failed to generate default profile for tests..."; | 95 LOG(FATAL) << "Failed to generate default profile for tests..."; |
96 } | 96 } |
97 | 97 |
98 g_default_profile_dir.Get() = default_profile_dir_.path(); | 98 g_default_profile_dir.Get() = default_profile_dir_.path(); |
99 | 99 |
100 if (!complex_profile_dir_.CreateUniqueTempDir()) { | 100 if (!complex_profile_dir_.CreateUniqueTempDir()) { |
101 LOG(FATAL) << "Failed to create complex profile directory..."; | 101 LOG(FATAL) << "Failed to create complex profile directory..."; |
102 } | 102 } |
103 | 103 |
104 if (!file_util::CopyDirectory(default_path, | 104 if (!base::CopyDirectory(default_path, |
105 complex_profile_dir_.path(), | 105 complex_profile_dir_.path(), |
106 true)) { | 106 true)) { |
107 LOG(FATAL) << "Failed to copy data to complex profile directory..."; | 107 LOG(FATAL) << "Failed to copy data to complex profile directory..."; |
108 } | 108 } |
109 | 109 |
110 // Copy the Extensions directory from the template into the | 110 // Copy the Extensions directory from the template into the |
111 // complex_profile_dir dir. | 111 // complex_profile_dir dir. |
112 base::FilePath base_data_dir; | 112 base::FilePath base_data_dir; |
113 if (!PathService::Get(chrome::DIR_TEST_DATA, &base_data_dir)) | 113 if (!PathService::Get(chrome::DIR_TEST_DATA, &base_data_dir)) |
114 LOG(FATAL) << "Failed to fetch test data dir"; | 114 LOG(FATAL) << "Failed to fetch test data dir"; |
115 | 115 |
116 base_data_dir = base_data_dir.AppendASCII("profiles"); | 116 base_data_dir = base_data_dir.AppendASCII("profiles"); |
117 base_data_dir = base_data_dir.AppendASCII("profile_with_complex_theme"); | 117 base_data_dir = base_data_dir.AppendASCII("profile_with_complex_theme"); |
118 base_data_dir = base_data_dir.AppendASCII("Default"); | 118 base_data_dir = base_data_dir.AppendASCII("Default"); |
119 | 119 |
120 if (!file_util::CopyDirectory(base_data_dir, | 120 if (!base::CopyDirectory(base_data_dir, complex_profile_dir_.path(), true)) |
121 complex_profile_dir_.path(), | |
122 true)) { | |
123 LOG(FATAL) << "Failed to copy default to complex profile"; | 121 LOG(FATAL) << "Failed to copy default to complex profile"; |
124 } | |
125 | 122 |
126 // Parse the manifest and make a temporary extension object because the | 123 // Parse the manifest and make a temporary extension object because the |
127 // theme system takes extensions as input. | 124 // theme system takes extensions as input. |
128 base::FilePath extension_base = | 125 base::FilePath extension_base = |
129 complex_profile_dir_.path() | 126 complex_profile_dir_.path() |
130 .AppendASCII("Default") | 127 .AppendASCII("Default") |
131 .AppendASCII("Extensions") | 128 .AppendASCII("Extensions") |
132 .AppendASCII(kThemeExtension) | 129 .AppendASCII(kThemeExtension) |
133 .AppendASCII("1.1"); | 130 .AppendASCII("1.1"); |
134 BuildCachedThemePakIn(extension_base); | 131 BuildCachedThemePakIn(extension_base); |
(...skipping 30 matching lines...) Expand all Loading... |
165 content::TestBrowserThread file_thread_(BrowserThread::FILE, | 162 content::TestBrowserThread file_thread_(BrowserThread::FILE, |
166 &message_loop_); | 163 &message_loop_); |
167 | 164 |
168 scoped_refptr<BrowserThemePack> theme( | 165 scoped_refptr<BrowserThemePack> theme( |
169 BrowserThemePack::BuildFromExtension(extension.get())); | 166 BrowserThemePack::BuildFromExtension(extension.get())); |
170 if (!theme.get()) | 167 if (!theme.get()) |
171 LOG(FATAL) << "Failed to load theme from extension"; | 168 LOG(FATAL) << "Failed to load theme from extension"; |
172 | 169 |
173 theme->WriteToDisk(extension_base.AppendASCII("Cached Theme.pak")); | 170 theme->WriteToDisk(extension_base.AppendASCII("Cached Theme.pak")); |
174 } | 171 } |
OLD | NEW |