| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
| 9 #include "base/string_split.h" | 9 #include "base/string_split.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 WARM, | 37 WARM, |
| 38 COLD | 38 COLD |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 enum TestImportance { | 41 enum TestImportance { |
| 42 NOT_IMPORTANT, | 42 NOT_IMPORTANT, |
| 43 IMPORTANT | 43 IMPORTANT |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 // Load a file on startup rather than about:blank. This tests a longer | 46 // Load a file on startup rather than about:blank. This tests a longer |
| 47 // startup path, including resource loading and the loading of gears.dll. | 47 // startup path, including resource loading. |
| 48 void SetUpWithFileURL() { | 48 void SetUpWithFileURL() { |
| 49 const FilePath file_url = ui_test_utils::GetTestFilePath( | 49 const FilePath file_url = ui_test_utils::GetTestFilePath( |
| 50 FilePath(FilePath::kCurrentDirectory), | 50 FilePath(FilePath::kCurrentDirectory), |
| 51 FilePath(FILE_PATH_LITERAL("simple.html"))); | 51 FilePath(FILE_PATH_LITERAL("simple.html"))); |
| 52 ASSERT_TRUE(file_util::PathExists(file_url)); | 52 ASSERT_TRUE(file_util::PathExists(file_url)); |
| 53 launch_arguments_.AppendArgPath(file_url); | 53 launch_arguments_.AppendArgPath(file_url); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Load a complex html file on startup represented by |which_tab|. | 56 // Load a complex html file on startup represented by |which_tab|. |
| 57 void SetUpWithComplexFileURL(unsigned int which_tab) { | 57 void SetUpWithComplexFileURL(unsigned int which_tab) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app)); | 134 ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app)); |
| 135 | 135 |
| 136 FilePath chrome_exe(dir_app.Append( | 136 FilePath chrome_exe(dir_app.Append( |
| 137 chrome::kBrowserProcessExecutablePath)); | 137 chrome::kBrowserProcessExecutablePath)); |
| 138 ASSERT_TRUE(EvictFileFromSystemCacheWrapper(chrome_exe)); | 138 ASSERT_TRUE(EvictFileFromSystemCacheWrapper(chrome_exe)); |
| 139 #if defined(OS_WIN) | 139 #if defined(OS_WIN) |
| 140 // chrome.dll is windows specific. | 140 // chrome.dll is windows specific. |
| 141 FilePath chrome_dll(dir_app.Append(FILE_PATH_LITERAL("chrome.dll"))); | 141 FilePath chrome_dll(dir_app.Append(FILE_PATH_LITERAL("chrome.dll"))); |
| 142 ASSERT_TRUE(EvictFileFromSystemCacheWrapper(chrome_dll)); | 142 ASSERT_TRUE(EvictFileFromSystemCacheWrapper(chrome_dll)); |
| 143 #endif | 143 #endif |
| 144 | |
| 145 #if defined(OS_WIN) | |
| 146 // TODO(port): Re-enable once gears is working on mac/linux. | |
| 147 FilePath gears_dll; | |
| 148 ASSERT_TRUE(PathService::Get(chrome::FILE_GEARS_PLUGIN, &gears_dll)); | |
| 149 ASSERT_TRUE(EvictFileFromSystemCacheWrapper(gears_dll)); | |
| 150 #else | |
| 151 NOTIMPLEMENTED() << "gears not enabled yet"; | |
| 152 #endif | |
| 153 } | 144 } |
| 154 UITest::SetUp(); | 145 UITest::SetUp(); |
| 155 TimeTicks end_time = TimeTicks::Now(); | 146 TimeTicks end_time = TimeTicks::Now(); |
| 156 | 147 |
| 157 // HACK: Chrome < 5.0.368.0 did not yet implement SendJSONRequest. | 148 // HACK: Chrome < 5.0.368.0 did not yet implement SendJSONRequest. |
| 158 { | 149 { |
| 159 std::string server_version = automation()->server_version(); | 150 std::string server_version = automation()->server_version(); |
| 160 std::vector<std::string> version_numbers; | 151 std::vector<std::string> version_numbers; |
| 161 base::SplitString(server_version, '.', &version_numbers); | 152 base::SplitString(server_version, '.', &version_numbers); |
| 162 int chrome_buildnum = 0; | 153 int chrome_buildnum = 0; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 ProxyLauncher::DEFAULT_THEME, 1, 0); | 354 ProxyLauncher::DEFAULT_THEME, 1, 0); |
| 364 } | 355 } |
| 365 | 356 |
| 366 TEST_F(StartupTest, MAYBE_PerfExtensionContentScript50) { | 357 TEST_F(StartupTest, MAYBE_PerfExtensionContentScript50) { |
| 367 SetUpWithFileURL(); | 358 SetUpWithFileURL(); |
| 368 SetUpWithExtensionsProfile("content_scripts50"); | 359 SetUpWithExtensionsProfile("content_scripts50"); |
| 369 RunStartupTest("warm", "extension_content_scripts50", WARM, NOT_IMPORTANT, | 360 RunStartupTest("warm", "extension_content_scripts50", WARM, NOT_IMPORTANT, |
| 370 ProxyLauncher::DEFAULT_THEME, 1, 0); | 361 ProxyLauncher::DEFAULT_THEME, 1, 0); |
| 371 } | 362 } |
| 372 | 363 |
| 373 #if defined(OS_WIN) | |
| 374 // TODO(port): Enable gears tests on linux/mac once gears is working. | |
| 375 TEST_F(StartupTest, PerfGears) { | |
| 376 SetUpWithFileURL(); | |
| 377 RunStartupTest("warm", "gears", WARM, NOT_IMPORTANT, | |
| 378 ProxyLauncher::DEFAULT_THEME, 1, 0); | |
| 379 } | |
| 380 | |
| 381 TEST_F(StartupTest, PerfColdGears) { | |
| 382 SetUpWithFileURL(); | |
| 383 RunStartupTest("cold", "gears", COLD, NOT_IMPORTANT, | |
| 384 ProxyLauncher::DEFAULT_THEME, 1, 0); | |
| 385 } | |
| 386 #endif | |
| 387 | |
| 388 TEST_F(StartupTest, PerfComplexTheme) { | 364 TEST_F(StartupTest, PerfComplexTheme) { |
| 389 RunStartupTest("warm", "t-theme", WARM, NOT_IMPORTANT, | 365 RunStartupTest("warm", "t-theme", WARM, NOT_IMPORTANT, |
| 390 ProxyLauncher::COMPLEX_THEME, 0, 0); | 366 ProxyLauncher::COMPLEX_THEME, 0, 0); |
| 391 } | 367 } |
| 392 | 368 |
| 393 #if defined(OS_LINUX) | 369 #if defined(OS_LINUX) |
| 394 TEST_F(StartupTest, PerfGtkTheme) { | 370 TEST_F(StartupTest, PerfGtkTheme) { |
| 395 RunStartupTest("warm", "gtk-theme", WARM, NOT_IMPORTANT, | 371 RunStartupTest("warm", "gtk-theme", WARM, NOT_IMPORTANT, |
| 396 ProxyLauncher::NATIVE_THEME, 0, 0); | 372 ProxyLauncher::NATIVE_THEME, 0, 0); |
| 397 } | 373 } |
| 398 | 374 |
| 399 TEST_F(StartupTest, PrefNativeFrame) { | 375 TEST_F(StartupTest, PrefNativeFrame) { |
| 400 RunStartupTest("warm", "custom-frame", WARM, NOT_IMPORTANT, | 376 RunStartupTest("warm", "custom-frame", WARM, NOT_IMPORTANT, |
| 401 ProxyLauncher::CUSTOM_FRAME, 0, 0); | 377 ProxyLauncher::CUSTOM_FRAME, 0, 0); |
| 402 } | 378 } |
| 403 | 379 |
| 404 TEST_F(StartupTest, PerfNativeFrameGtkTheme) { | 380 TEST_F(StartupTest, PerfNativeFrameGtkTheme) { |
| 405 RunStartupTest("warm", "custom-frame-gtk-theme", WARM, NOT_IMPORTANT, | 381 RunStartupTest("warm", "custom-frame-gtk-theme", WARM, NOT_IMPORTANT, |
| 406 ProxyLauncher::CUSTOM_FRAME_NATIVE_THEME, 0, 0); | 382 ProxyLauncher::CUSTOM_FRAME_NATIVE_THEME, 0, 0); |
| 407 } | 383 } |
| 408 #endif | 384 #endif |
| 409 | 385 |
| 410 } // namespace | 386 } // namespace |
| OLD | NEW |