| 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 #include "chrome_frame/test/perf/chrome_frame_perftest.h" | 4 #include "chrome_frame/test/perf/chrome_frame_perftest.h" |
| 5 | 5 |
| 6 #include <atlwin.h> | 6 #include <atlwin.h> |
| 7 #include <atlhost.h> | 7 #include <atlhost.h> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <vector> | 9 #include <vector> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 virtual void SetUp() { | 284 virtual void SetUp() { |
| 285 SetConfigBool(kChromeFrameUnpinnedMode, true); | 285 SetConfigBool(kChromeFrameUnpinnedMode, true); |
| 286 ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app_)); | 286 ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app_)); |
| 287 | 287 |
| 288 chrome_dll_ = dir_app_.Append(FILE_PATH_LITERAL("chrome.dll")); | 288 chrome_dll_ = dir_app_.Append(FILE_PATH_LITERAL("chrome.dll")); |
| 289 chrome_exe_ = dir_app_.Append( | 289 chrome_exe_ = dir_app_.Append( |
| 290 FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName)); | 290 FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName)); |
| 291 chrome_frame_dll_ = dir_app_.Append(FILE_PATH_LITERAL("servers")); | 291 chrome_frame_dll_ = dir_app_.Append(FILE_PATH_LITERAL("servers")); |
| 292 chrome_frame_dll_ = chrome_frame_dll_.Append( | 292 chrome_frame_dll_ = chrome_frame_dll_.Append( |
| 293 FilePath::FromWStringHack(kChromeFrameDllName)); | 293 FilePath::FromWStringHack(kChromeFrameDllName)); |
| 294 DLOG(INFO) << __FUNCTION__ << ": " << chrome_frame_dll_.value(); | 294 icu_dll_ = dir_app_.Append(FILE_PATH_LITERAL("icudt42.dll")); |
| 295 gears_dll_ = dir_app_.Append(FILE_PATH_LITERAL("gears.dll")); |
| 296 avcodec52_dll_ = dir_app_.Append(FILE_PATH_LITERAL("avcodec-52.dll")); |
| 297 avformat52_dll_ = dir_app_.Append(FILE_PATH_LITERAL("avformat-52.dll")); |
| 298 avutil50_dll_ = dir_app_.Append(FILE_PATH_LITERAL("avutil-50.dll")); |
| 295 } | 299 } |
| 296 virtual void TearDown() { | 300 virtual void TearDown() { |
| 297 DeleteConfigValue(kChromeFrameUnpinnedMode); | 301 DeleteConfigValue(kChromeFrameUnpinnedMode); |
| 298 } | 302 } |
| 299 | 303 |
| 300 // TODO(iyengar) | 304 // TODO(iyengar) |
| 301 // This function is similar to the RunStartupTest function used in chrome | 305 // This function is similar to the RunStartupTest function used in chrome |
| 302 // startup tests. Refactor into a common implementation. | 306 // startup tests. Refactor into a common implementation. |
| 303 void RunStartupTest(const char* graph, const char* trace, | 307 void RunStartupTest(const char* graph, const char* trace, |
| 304 const char* startup_url, bool test_cold, | 308 const char* startup_url, bool test_cold, |
| 305 int total_binaries, const FilePath binaries_to_evict[], | 309 int total_binaries, const FilePath binaries_to_evict[], |
| 306 bool important, bool ignore_cache_error) { | 310 bool important, bool ignore_cache_error) { |
| 307 const int kNumCycles = 20; | 311 const int kNumCycles = 20; |
| 308 | 312 |
| 309 startup_url_ = startup_url; | 313 startup_url_ = startup_url; |
| 310 | 314 |
| 311 TimeDelta timings[kNumCycles]; | 315 TimeDelta timings[kNumCycles]; |
| 312 | 316 |
| 313 for (int i = 0; i < kNumCycles; ++i) { | 317 for (int i = 0; i < kNumCycles; ++i) { |
| 314 if (test_cold) { | 318 if (test_cold) { |
| 315 for (int binary_index = 0; binary_index < total_binaries; | 319 for (int binary_index = 0; binary_index < total_binaries; |
| 316 binary_index++) { | 320 binary_index++) { |
| 317 bool result = EvictFileFromSystemCacheWrapper( | 321 bool result = EvictFileFromSystemCacheWrapper( |
| 318 binaries_to_evict[binary_index]); | 322 binaries_to_evict[binary_index]); |
| 319 if (!ignore_cache_error) { | 323 if (!ignore_cache_error) { |
| 320 ASSERT_TRUE(result); | 324 ASSERT_TRUE(result); |
| 321 } else if (!result) { | 325 } else if (!result) { |
| 326 LOG(ERROR) << GetLastError(); |
| 322 printf("\nFailed to evict file %ls from cache. Not running test\n", | 327 printf("\nFailed to evict file %ls from cache. Not running test\n", |
| 323 binaries_to_evict[binary_index].value().c_str()); | 328 binaries_to_evict[binary_index].value().c_str()); |
| 324 return; | 329 return; |
| 325 } | 330 } |
| 326 } | 331 } |
| 327 } | 332 } |
| 328 | 333 |
| 329 TimeTicks start_time, end_time; | 334 TimeTicks start_time, end_time; |
| 330 | 335 |
| 331 RunStartupTestImpl(&start_time, &end_time); | 336 RunStartupTestImpl(&start_time, &end_time); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 344 for (int i = 0; i < kNumCycles; ++i) | 349 for (int i = 0; i < kNumCycles; ++i) |
| 345 StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); | 350 StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); |
| 346 | 351 |
| 347 PrintResultList(graph, "", trace, times, "ms", important); | 352 PrintResultList(graph, "", trace, times, "ms", important); |
| 348 } | 353 } |
| 349 | 354 |
| 350 FilePath dir_app_; | 355 FilePath dir_app_; |
| 351 FilePath chrome_dll_; | 356 FilePath chrome_dll_; |
| 352 FilePath chrome_exe_; | 357 FilePath chrome_exe_; |
| 353 FilePath chrome_frame_dll_; | 358 FilePath chrome_frame_dll_; |
| 359 FilePath icu_dll_; |
| 360 FilePath gears_dll_; |
| 361 FilePath avcodec52_dll_; |
| 362 FilePath avformat52_dll_; |
| 363 FilePath avutil50_dll_; |
| 354 | 364 |
| 355 protected: | 365 protected: |
| 356 // Individual startup tests should implement this function. | 366 // Individual startup tests should implement this function. |
| 357 virtual void RunStartupTestImpl(TimeTicks* start_time, | 367 virtual void RunStartupTestImpl(TimeTicks* start_time, |
| 358 TimeTicks* end_time) {} | 368 TimeTicks* end_time) {} |
| 359 | 369 |
| 360 // The host is torn down by this function. It should not be used after | 370 // The host is torn down by this function. It should not be used after |
| 361 // this function returns. | 371 // this function returns. |
| 362 static void ReleaseHostComReferences(CAxWindow& host) { | 372 static void ReleaseHostComReferences(CAxWindow& host) { |
| 363 CComPtr<IAxWinHostWindow> spWinHost; | 373 CComPtr<IAxWinHostWindow> spWinHost; |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 RunStartupTest("warm", "t", "about:blank", false /* cold */, 0, NULL, | 927 RunStartupTest("warm", "t", "about:blank", false /* cold */, 0, NULL, |
| 918 true /* important */, false); | 928 true /* important */, false); |
| 919 } | 929 } |
| 920 | 930 |
| 921 TEST_F(ChromeFrameBinariesLoadTest, PerfWarm) { | 931 TEST_F(ChromeFrameBinariesLoadTest, PerfWarm) { |
| 922 RunStartupTest("binary_load_warm", "t", "", false /* cold */, 0, NULL, | 932 RunStartupTest("binary_load_warm", "t", "", false /* cold */, 0, NULL, |
| 923 true /* important */, false); | 933 true /* important */, false); |
| 924 } | 934 } |
| 925 | 935 |
| 926 TEST_F(ChromeFrameStartupTestActiveX, PerfCold) { | 936 TEST_F(ChromeFrameStartupTestActiveX, PerfCold) { |
| 927 FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_, chrome_frame_dll_}; | 937 FilePath binaries_to_evict[] = { gears_dll_, avcodec52_dll_, |
| 938 avformat52_dll_, avutil50_dll_, chrome_exe_, chrome_dll_, |
| 939 chrome_frame_dll_}; |
| 928 RunStartupTest("cold", "t", "about:blank", true /* cold */, | 940 RunStartupTest("cold", "t", "about:blank", true /* cold */, |
| 929 arraysize(binaries_to_evict), binaries_to_evict, | 941 arraysize(binaries_to_evict), binaries_to_evict, |
| 930 false /* not important */, false); | 942 false /* not important */, false); |
| 931 } | 943 } |
| 932 | 944 |
| 933 TEST_F(ChromeFrameBinariesLoadTest, PerfCold) { | 945 TEST_F(ChromeFrameBinariesLoadTest, PerfCold) { |
| 934 FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_, chrome_frame_dll_}; | 946 FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_, chrome_frame_dll_}; |
| 935 RunStartupTest("binary_load_cold", "t", "", true /* cold */, | 947 RunStartupTest("binary_load_cold", "t", "", true /* cold */, |
| 936 arraysize(binaries_to_evict), binaries_to_evict, | 948 arraysize(binaries_to_evict), binaries_to_evict, |
| 937 false /* not important */, false); | 949 false /* not important */, false); |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1063 ASSERT_TRUE(silverlight_key.ReadValue(L"", &plugin_path)); | 1075 ASSERT_TRUE(silverlight_key.ReadValue(L"", &plugin_path)); |
| 1064 ASSERT_FALSE(plugin_path.empty()); | 1076 ASSERT_FALSE(plugin_path.empty()); |
| 1065 | 1077 |
| 1066 FilePath silverlight_path = FilePath::FromWStringHack(plugin_path); | 1078 FilePath silverlight_path = FilePath::FromWStringHack(plugin_path); |
| 1067 FilePath binaries_to_evict[] = {silverlight_path}; | 1079 FilePath binaries_to_evict[] = {silverlight_path}; |
| 1068 | 1080 |
| 1069 RunStartupTest("creation_cold", "t_silverlight", "", true /* cold */, | 1081 RunStartupTest("creation_cold", "t_silverlight", "", true /* cold */, |
| 1070 arraysize(binaries_to_evict), binaries_to_evict, | 1082 arraysize(binaries_to_evict), binaries_to_evict, |
| 1071 false /* important */, true); | 1083 false /* important */, true); |
| 1072 } | 1084 } |
| OLD | NEW |