1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/test/ui/ui_perf_test.h" 6 7 #include "base/path_service.h" 8 #include "chrome/common/chrome_paths.h" 9 #include "chrome/common/chrome_switches.h" 10 #include "chrome/test/base/chrome_process_util.h" 11 #include "chrome/test/base/test_switches.h" 12 #include "chrome/test/perf/perf_test.h" 13 14 void UIPerfTest::SetLaunchSwitches() { 15 UITestBase::SetLaunchSwitches(); 16 17 // Reduce performance test variance by disabling background networking. 18 launch_arguments_.AppendSwitch(switches::kDisableBackgroundNetworking); 19 20 // We don't want tests to slow down mysteriously when we update the minimum 21 // plugin version. 22 launch_arguments_.AppendSwitch(switches::kAllowOutdatedPlugins); 23 } 24 25 void UIPerfTest::PrintIOPerfInfo(const char* test_name) { 26 ChromeProcessList chrome_processes( 27 GetRunningChromeProcesses(browser_process_id())); 28 perf_test::PrintIOPerfInfo(test_name, chrome_processes, 29 browser_process_id()); 30 } 31 32 void UIPerfTest::PrintMemoryUsageInfo(const char* test_name) { 33 ChromeProcessList chrome_processes( 34 GetRunningChromeProcesses(browser_process_id())); 35 perf_test::PrintMemoryUsageInfo(test_name, chrome_processes, 36 browser_process_id()); 37 } 38 39 void UIPerfTest::UseReferenceBuild() { 40 base::FilePath dir; 41 PathService::Get(chrome::DIR_TEST_TOOLS, &dir); 42 dir = dir.AppendASCII("reference_build"); 43 #if defined(OS_WIN) 44 dir = dir.AppendASCII("chrome_win"); 45 #elif defined(OS_LINUX) 46 dir = dir.AppendASCII("chrome_linux"); 47 #elif defined(OS_MACOSX) 48 dir = dir.AppendASCII("chrome_mac"); 49 #endif 50 launch_arguments_.AppendSwitch(switches::kEnableChromiumBranding); 51 SetBrowserDirectory(dir); 52 } 53