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

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

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