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

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

Issue 15044012: Revert "Add debugging statements for problem that only happens on bots." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | « no previous file | no next file » | 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) 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 <stdio.h>
8
9 #include "base/file_util.h" 7 #include "base/file_util.h"
10 #include "base/json/json_file_value_serializer.h" 8 #include "base/json/json_file_value_serializer.h"
11 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
12 #include "base/logging.h" 10 #include "base/logging.h"
13 #include "base/message_loop.h" 11 #include "base/message_loop.h"
14 #include "base/path_service.h" 12 #include "base/path_service.h"
15 #include "base/string_util.h" 13 #include "base/string_util.h"
16 #include "base/threading/platform_thread.h" 14 #include "base/threading/platform_thread.h"
17 #include "base/utf_string_conversions.h" 15 #include "base/utf_string_conversions.h"
18 #include "chrome/browser/themes/browser_theme_pack.h" 16 #include "chrome/browser/themes/browser_theme_pack.h"
(...skipping 19 matching lines...) Expand all
38 36
39 base::LazyInstance<base::FilePath> g_default_profile_dir = 37 base::LazyInstance<base::FilePath> g_default_profile_dir =
40 LAZY_INSTANCE_INITIALIZER; 38 LAZY_INSTANCE_INITIALIZER;
41 base::LazyInstance<base::FilePath> g_complex_profile_dir = 39 base::LazyInstance<base::FilePath> g_complex_profile_dir =
42 LAZY_INSTANCE_INITIALIZER; 40 LAZY_INSTANCE_INITIALIZER;
43 41
44 } // namespace 42 } // namespace
45 43
46 PerfUITestSuite::PerfUITestSuite(int argc, char** argv) 44 PerfUITestSuite::PerfUITestSuite(int argc, char** argv)
47 : UITestSuite(argc, argv) { 45 : UITestSuite(argc, argv) {
48 fprintf(stderr, "In the constructor of the PerfUITestSuite.\n");
49 base::PlatformThread::SetName("Tests_Main"); 46 base::PlatformThread::SetName("Tests_Main");
50 } 47 }
51 48
52 PerfUITestSuite::~PerfUITestSuite() { 49 PerfUITestSuite::~PerfUITestSuite() {
53 } 50 }
54 51
55 base::FilePath PerfUITestSuite::GetPathForProfileType( 52 base::FilePath PerfUITestSuite::GetPathForProfileType(
56 ProfileType profile_type) { 53 ProfileType profile_type) {
57 switch (profile_type) { 54 switch (profile_type) {
58 case DEFAULT_THEME: 55 case DEFAULT_THEME:
59 return g_default_profile_dir.Get(); 56 return g_default_profile_dir.Get();
60 case COMPLEX_THEME: 57 case COMPLEX_THEME:
61 return g_complex_profile_dir.Get(); 58 return g_complex_profile_dir.Get();
62 default: 59 default:
63 NOTREACHED(); 60 NOTREACHED();
64 return base::FilePath(); 61 return base::FilePath();
65 } 62 }
66 } 63 }
67 64
68 void PerfUITestSuite::Initialize() { 65 void PerfUITestSuite::Initialize() {
69 #if defined(OS_WIN) 66 #if defined(OS_WIN)
70 // On Windows, make sure we've loaded the main chrome dll for its resource 67 // On Windows, make sure we've loaded the main chrome dll for its resource
71 // before we let our parent class initialize the shared resource bundle 68 // before we let our parent class initialize the shared resource bundle
72 // infrastructure. We have to do this manually because the extension system 69 // infrastructure. We have to do this manually because the extension system
73 // uses several resources which, on Windows, are only compiled into the 70 // uses several resources which, on Windows, are only compiled into the
74 // browser DLL, but the base chrome testing stuff is used outside of browser. 71 // browser DLL, but the base chrome testing stuff is used outside of browser.
75 // 72 //
76 // TODO(darin): Kill this once http://crbug.com/52609 is fixed. 73 // TODO(darin): Kill this once http://crbug.com/52609 is fixed.
77 base::FilePath dll; 74 base::FilePath dll;
78 fprintf(stderr, "About to get dir module.\n");
79 PathService::Get(base::DIR_MODULE, &dll); 75 PathService::Get(base::DIR_MODULE, &dll);
80 dll = dll.Append(chrome::kBrowserResourcesDll); 76 dll = dll.Append(chrome::kBrowserResourcesDll);
81 fprintf(stderr, "About to LoadLibraryExW.\n");
82 HMODULE res_mod = ::LoadLibraryExW(dll.value().c_str(), 77 HMODULE res_mod = ::LoadLibraryExW(dll.value().c_str(),
83 NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE); 78 NULL, LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_IMAGE_RESOURCE);
84 DCHECK(res_mod); 79 DCHECK(res_mod);
85 fprintf(stderr, "About to _AtlBaseModule.SetResourceInstance().\n");
86 _AtlBaseModule.SetResourceInstance(res_mod); 80 _AtlBaseModule.SetResourceInstance(res_mod);
87 81
88 fprintf(stderr, "About to ui::SetResourcesDataDLL.\n");
89 ui::SetResourcesDataDLL(_AtlBaseModule.GetResourceInstance()); 82 ui::SetResourcesDataDLL(_AtlBaseModule.GetResourceInstance());
90 #endif 83 #endif
91 84
92 fprintf(stderr, "About to go through UITestSuite::Initialize().\n");
93 UITestSuite::Initialize(); 85 UITestSuite::Initialize();
94 86
95 fprintf(stderr, "About to default_profile_dir_.CreateUniqueTempDir().\n");
96 if (!default_profile_dir_.CreateUniqueTempDir()) { 87 if (!default_profile_dir_.CreateUniqueTempDir()) {
97 LOG(FATAL) << "Failed to create default profile directory..."; 88 LOG(FATAL) << "Failed to create default profile directory...";
98 } 89 }
99 90
100 // Build a profile in default profile dir. 91 // Build a profile in default profile dir.
101 fprintf(stderr, "About to call GenerateProfile().\n");
102 base::FilePath default_path = 92 base::FilePath default_path =
103 default_profile_dir_.path().AppendASCII("Default"); 93 default_profile_dir_.path().AppendASCII("Default");
104 if (!GenerateProfile(TOP_SITES, kNumURLs, default_path)) { 94 if (!GenerateProfile(TOP_SITES, kNumURLs, default_path)) {
105 LOG(FATAL) << "Failed to generate default profile for tests..."; 95 LOG(FATAL) << "Failed to generate default profile for tests...";
106 } 96 }
107 97
108 g_default_profile_dir.Get() = default_profile_dir_.path(); 98 g_default_profile_dir.Get() = default_profile_dir_.path();
109 99
110 fprintf(stderr, "About to build second temp dir().\n");
111 if (!complex_profile_dir_.CreateUniqueTempDir()) { 100 if (!complex_profile_dir_.CreateUniqueTempDir()) {
112 LOG(FATAL) << "Failed to create complex profile directory..."; 101 LOG(FATAL) << "Failed to create complex profile directory...";
113 } 102 }
114 103
115 fprintf(stderr, "About to copy profile directory.\n");
116 if (!file_util::CopyDirectory(default_path, 104 if (!file_util::CopyDirectory(default_path,
117 complex_profile_dir_.path(), 105 complex_profile_dir_.path(),
118 true)) { 106 true)) {
119 LOG(FATAL) << "Failed to copy data to complex profile directory..."; 107 LOG(FATAL) << "Failed to copy data to complex profile directory...";
120 } 108 }
121 109
122 // Copy the Extensions directory from the template into the 110 // Copy the Extensions directory from the template into the
123 // complex_profile_dir dir. 111 // complex_profile_dir dir.
124 base::FilePath base_data_dir; 112 base::FilePath base_data_dir;
125 if (!PathService::Get(chrome::DIR_TEST_DATA, &base_data_dir)) 113 if (!PathService::Get(chrome::DIR_TEST_DATA, &base_data_dir))
126 LOG(FATAL) << "Failed to fetch test data dir"; 114 LOG(FATAL) << "Failed to fetch test data dir";
127 115
128 base_data_dir = base_data_dir.AppendASCII("profiles"); 116 base_data_dir = base_data_dir.AppendASCII("profiles");
129 base_data_dir = base_data_dir.AppendASCII("profile_with_complex_theme"); 117 base_data_dir = base_data_dir.AppendASCII("profile_with_complex_theme");
130 base_data_dir = base_data_dir.AppendASCII("Default"); 118 base_data_dir = base_data_dir.AppendASCII("Default");
131 119
132 fprintf(stderr, "About to copy extensions directory.\n");
133 if (!file_util::CopyDirectory(base_data_dir, 120 if (!file_util::CopyDirectory(base_data_dir,
134 complex_profile_dir_.path(), 121 complex_profile_dir_.path(),
135 true)) { 122 true)) {
136 LOG(FATAL) << "Failed to copy default to complex profile"; 123 LOG(FATAL) << "Failed to copy default to complex profile";
137 } 124 }
138 125
139 fprintf(stderr, "About to build theme pack.\n");
140 // Parse the manifest and make a temporary extension object because the 126 // Parse the manifest and make a temporary extension object because the
141 // theme system takes extensions as input. 127 // theme system takes extensions as input.
142 base::FilePath extension_base = 128 base::FilePath extension_base =
143 complex_profile_dir_.path() 129 complex_profile_dir_.path()
144 .AppendASCII("Default") 130 .AppendASCII("Default")
145 .AppendASCII("Extensions") 131 .AppendASCII("Extensions")
146 .AppendASCII(kThemeExtension) 132 .AppendASCII(kThemeExtension)
147 .AppendASCII("1.1"); 133 .AppendASCII("1.1");
148 BuildCachedThemePakIn(extension_base); 134 BuildCachedThemePakIn(extension_base);
149 135
150 g_complex_profile_dir.Get() = complex_profile_dir_.path(); 136 g_complex_profile_dir.Get() = complex_profile_dir_.path();
151 fprintf(stderr, "All done with init.\n");
152 } 137 }
153 138
154 void PerfUITestSuite::BuildCachedThemePakIn( 139 void PerfUITestSuite::BuildCachedThemePakIn(
155 const base::FilePath& extension_base) { 140 const base::FilePath& extension_base) {
156 int error_code = 0; 141 int error_code = 0;
157 std::string error; 142 std::string error;
158 JSONFileValueSerializer serializer( 143 JSONFileValueSerializer serializer(
159 extension_base.AppendASCII("manifest.json")); 144 extension_base.AppendASCII("manifest.json"));
160 scoped_ptr<DictionaryValue> valid_value(static_cast<DictionaryValue*>( 145 scoped_ptr<DictionaryValue> valid_value(static_cast<DictionaryValue*>(
161 serializer.Deserialize(&error_code, &error))); 146 serializer.Deserialize(&error_code, &error)));
(...skipping 18 matching lines...) Expand all
180 content::TestBrowserThread file_thread_(BrowserThread::FILE, 165 content::TestBrowserThread file_thread_(BrowserThread::FILE,
181 &message_loop_); 166 &message_loop_);
182 167
183 scoped_refptr<BrowserThemePack> theme( 168 scoped_refptr<BrowserThemePack> theme(
184 BrowserThemePack::BuildFromExtension(extension)); 169 BrowserThemePack::BuildFromExtension(extension));
185 if (!theme) 170 if (!theme)
186 LOG(FATAL) << "Failed to load theme from extension"; 171 LOG(FATAL) << "Failed to load theme from extension";
187 172
188 theme->WriteToDisk(extension_base.AppendASCII("Cached Theme.pak")); 173 theme->WriteToDisk(extension_base.AppendASCII("Cached Theme.pak"));
189 } 174 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698