| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 chrome_frame_dll_ = dir_app_.Append(kChromeFrameDllName); | 296 chrome_frame_dll_ = dir_app_.Append(kChromeFrameDllName); |
| 297 icu_dll_ = dir_app_.Append(L"icudt.dll"); | 297 icu_dll_ = dir_app_.Append(L"icudt.dll"); |
| 298 ffmpegsumo_dll_ = dir_app_.Append(L"ffmpegsumo.dll"); | 298 ffmpegsumo_dll_ = dir_app_.Append(L"ffmpegsumo.dll"); |
| 299 } | 299 } |
| 300 | 300 |
| 301 // TODO(iyengar) | 301 // TODO(iyengar) |
| 302 // This function is similar to the RunStartupTest function used in chrome | 302 // This function is similar to the RunStartupTest function used in chrome |
| 303 // startup tests. Refactor into a common implementation. | 303 // startup tests. Refactor into a common implementation. |
| 304 void RunStartupTest(const char* graph, const char* trace, | 304 void RunStartupTest(const char* graph, const char* trace, |
| 305 const char* startup_url, bool test_cold, | 305 const char* startup_url, bool test_cold, |
| 306 int total_binaries, const FilePath binaries_to_evict[], | 306 int total_binaries, |
| 307 const base::FilePath binaries_to_evict[], |
| 307 bool important, bool ignore_cache_error) { | 308 bool important, bool ignore_cache_error) { |
| 308 const int kNumCycles = 20; | 309 const int kNumCycles = 20; |
| 309 | 310 |
| 310 startup_url_ = startup_url; | 311 startup_url_ = startup_url; |
| 311 | 312 |
| 312 TimeDelta timings[kNumCycles]; | 313 TimeDelta timings[kNumCycles]; |
| 313 | 314 |
| 314 for (int i = 0; i < kNumCycles; ++i) { | 315 for (int i = 0; i < kNumCycles; ++i) { |
| 315 if (test_cold) { | 316 if (test_cold) { |
| 316 for (int binary_index = 0; binary_index < total_binaries; | 317 for (int binary_index = 0; binary_index < total_binaries; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 341 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(50)); | 342 base::PlatformThread::Sleep(base::TimeDelta::FromMilliseconds(50)); |
| 342 } | 343 } |
| 343 | 344 |
| 344 std::string times; | 345 std::string times; |
| 345 for (int i = 0; i < kNumCycles; ++i) | 346 for (int i = 0; i < kNumCycles; ++i) |
| 346 base::StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); | 347 base::StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); |
| 347 | 348 |
| 348 perf_test::PrintResultList(graph, "", trace, times, "ms", important); | 349 perf_test::PrintResultList(graph, "", trace, times, "ms", important); |
| 349 } | 350 } |
| 350 | 351 |
| 351 FilePath dir_app_; | 352 base::FilePath dir_app_; |
| 352 FilePath chrome_dll_; | 353 base::FilePath chrome_dll_; |
| 353 FilePath chrome_exe_; | 354 base::FilePath chrome_exe_; |
| 354 FilePath chrome_frame_dll_; | 355 base::FilePath chrome_frame_dll_; |
| 355 FilePath icu_dll_; | 356 base::FilePath icu_dll_; |
| 356 FilePath ffmpegsumo_dll_; | 357 base::FilePath ffmpegsumo_dll_; |
| 357 | 358 |
| 358 protected: | 359 protected: |
| 359 // Individual startup tests should implement this function. | 360 // Individual startup tests should implement this function. |
| 360 virtual void RunStartupTestImpl(TimeTicks* start_time, | 361 virtual void RunStartupTestImpl(TimeTicks* start_time, |
| 361 TimeTicks* end_time) {} | 362 TimeTicks* end_time) {} |
| 362 | 363 |
| 363 // The host is torn down by this function. It should not be used after | 364 // The host is torn down by this function. It should not be used after |
| 364 // this function returns. | 365 // this function returns. |
| 365 static void ReleaseHostComReferences(CAxWindow& host) { | 366 static void ReleaseHostComReferences(CAxWindow& host) { |
| 366 CComPtr<IAxWinHostWindow> spWinHost; | 367 CComPtr<IAxWinHostWindow> spWinHost; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 public: | 467 public: |
| 467 // override the browser directory to use the reference build instead. | 468 // override the browser directory to use the reference build instead. |
| 468 virtual void SetUp() { | 469 virtual void SetUp() { |
| 469 // Register the reference build Chrome Frame DLL. | 470 // Register the reference build Chrome Frame DLL. |
| 470 chrome_frame_registrar_.reset(new ScopedChromeFrameRegistrar( | 471 chrome_frame_registrar_.reset(new ScopedChromeFrameRegistrar( |
| 471 ScopedChromeFrameRegistrar::SYSTEM_LEVEL)); | 472 ScopedChromeFrameRegistrar::SYSTEM_LEVEL)); |
| 472 chrome_frame_registrar_->RegisterReferenceChromeFrameBuild(); | 473 chrome_frame_registrar_->RegisterReferenceChromeFrameBuild(); |
| 473 | 474 |
| 474 ChromeFrameStartupTest::SetUp(); | 475 ChromeFrameStartupTest::SetUp(); |
| 475 | 476 |
| 476 chrome_frame_dll_ = FilePath( | 477 chrome_frame_dll_ = base::FilePath( |
| 477 chrome_frame_registrar_->GetReferenceChromeFrameDllPath()); | 478 chrome_frame_registrar_->GetReferenceChromeFrameDllPath()); |
| 478 DVLOG(1) << __FUNCTION__ << ": " << chrome_frame_dll_.value(); | 479 DVLOG(1) << __FUNCTION__ << ": " << chrome_frame_dll_.value(); |
| 479 } | 480 } |
| 480 | 481 |
| 481 virtual void TearDown() { | 482 virtual void TearDown() { |
| 482 // Reregister the Chrome Frame DLL in the build directory. | 483 // Reregister the Chrome Frame DLL in the build directory. |
| 483 chrome_frame_registrar_.reset(NULL); | 484 chrome_frame_registrar_.reset(NULL); |
| 484 } | 485 } |
| 485 }; | 486 }; |
| 486 | 487 |
| (...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 940 } | 941 } |
| 941 }; | 942 }; |
| 942 | 943 |
| 943 // TODO(rogerm): Flesh out the *PreReadImage* tests to validate an observed | 944 // TODO(rogerm): Flesh out the *PreReadImage* tests to validate an observed |
| 944 // change in paging behaviour between raw loading and pre-reading. | 945 // change in paging behaviour between raw loading and pre-reading. |
| 945 | 946 |
| 946 // TODO(rogerm): Add checks to the *PreReadImage* tests to validate the | 947 // TODO(rogerm): Add checks to the *PreReadImage* tests to validate the |
| 947 // handling of invalid pe files and paths as input. | 948 // handling of invalid pe files and paths as input. |
| 948 | 949 |
| 949 TEST(ImagePreReader, PreReadImage) { | 950 TEST(ImagePreReader, PreReadImage) { |
| 950 FilePath current_exe; | 951 base::FilePath current_exe; |
| 951 ASSERT_TRUE(PathService::Get(base::FILE_EXE, ¤t_exe)); | 952 ASSERT_TRUE(PathService::Get(base::FILE_EXE, ¤t_exe)); |
| 952 | 953 |
| 953 int64 file_size_64 = 0; | 954 int64 file_size_64 = 0; |
| 954 ASSERT_TRUE(file_util::GetFileSize(current_exe, &file_size_64)); | 955 ASSERT_TRUE(file_util::GetFileSize(current_exe, &file_size_64)); |
| 955 ASSERT_TRUE(file_size_64 < std::numeric_limits<std::size_t>::max()); | 956 ASSERT_TRUE(file_size_64 < std::numeric_limits<std::size_t>::max()); |
| 956 size_t file_size = static_cast<size_t>(file_size_64); | 957 size_t file_size = static_cast<size_t>(file_size_64); |
| 957 | 958 |
| 958 const wchar_t* module_path = current_exe.value().c_str(); | 959 const wchar_t* module_path = current_exe.value().c_str(); |
| 959 const size_t kStepSize = 2 * 1024 * 1024; | 960 const size_t kStepSize = 2 * 1024 * 1024; |
| 960 | 961 |
| 961 ASSERT_TRUE( | 962 ASSERT_TRUE( |
| 962 ImagePreReader::PreReadImage(module_path, 0, kStepSize)); | 963 ImagePreReader::PreReadImage(module_path, 0, kStepSize)); |
| 963 ASSERT_TRUE( | 964 ASSERT_TRUE( |
| 964 ImagePreReader::PreReadImage(module_path, file_size / 4, kStepSize)); | 965 ImagePreReader::PreReadImage(module_path, file_size / 4, kStepSize)); |
| 965 ASSERT_TRUE( | 966 ASSERT_TRUE( |
| 966 ImagePreReader::PreReadImage(module_path, file_size / 2, kStepSize)); | 967 ImagePreReader::PreReadImage(module_path, file_size / 2, kStepSize)); |
| 967 ASSERT_TRUE( | 968 ASSERT_TRUE( |
| 968 ImagePreReader::PreReadImage(module_path, file_size, kStepSize)); | 969 ImagePreReader::PreReadImage(module_path, file_size, kStepSize)); |
| 969 ASSERT_TRUE( | 970 ASSERT_TRUE( |
| 970 ImagePreReader::PreReadImage(module_path, file_size * 2, kStepSize)); | 971 ImagePreReader::PreReadImage(module_path, file_size * 2, kStepSize)); |
| 971 } | 972 } |
| 972 | 973 |
| 973 TEST(ImagePreReader, PartialPreReadImage) { | 974 TEST(ImagePreReader, PartialPreReadImage) { |
| 974 FilePath current_exe; | 975 base::FilePath current_exe; |
| 975 ASSERT_TRUE(PathService::Get(base::FILE_EXE, ¤t_exe)); | 976 ASSERT_TRUE(PathService::Get(base::FILE_EXE, ¤t_exe)); |
| 976 | 977 |
| 977 const wchar_t* module_path = current_exe.value().c_str(); | 978 const wchar_t* module_path = current_exe.value().c_str(); |
| 978 const size_t kStepSize = 2 * 1024 * 1024; | 979 const size_t kStepSize = 2 * 1024 * 1024; |
| 979 | 980 |
| 980 ASSERT_TRUE( | 981 ASSERT_TRUE( |
| 981 ImagePreReader::PartialPreReadImage(module_path, 0, kStepSize)); | 982 ImagePreReader::PartialPreReadImage(module_path, 0, kStepSize)); |
| 982 ASSERT_TRUE( | 983 ASSERT_TRUE( |
| 983 ImagePreReader::PartialPreReadImage(module_path, 25, kStepSize)); | 984 ImagePreReader::PartialPreReadImage(module_path, 25, kStepSize)); |
| 984 ASSERT_TRUE( | 985 ASSERT_TRUE( |
| 985 ImagePreReader::PartialPreReadImage(module_path, 50, kStepSize)); | 986 ImagePreReader::PartialPreReadImage(module_path, 50, kStepSize)); |
| 986 ASSERT_TRUE( | 987 ASSERT_TRUE( |
| 987 ImagePreReader::PartialPreReadImage(module_path, 100, kStepSize)); | 988 ImagePreReader::PartialPreReadImage(module_path, 100, kStepSize)); |
| 988 ASSERT_TRUE( | 989 ASSERT_TRUE( |
| 989 ImagePreReader::PartialPreReadImage(module_path, 150, kStepSize)); | 990 ImagePreReader::PartialPreReadImage(module_path, 150, kStepSize)); |
| 990 } | 991 } |
| 991 | 992 |
| 992 TEST(ImagePreReader, PartialPreReadImageOnDisk) { | 993 TEST(ImagePreReader, PartialPreReadImageOnDisk) { |
| 993 FilePath current_exe; | 994 base::FilePath current_exe; |
| 994 ASSERT_TRUE(PathService::Get(base::FILE_EXE, ¤t_exe)); | 995 ASSERT_TRUE(PathService::Get(base::FILE_EXE, ¤t_exe)); |
| 995 | 996 |
| 996 const wchar_t* module_path = current_exe.value().c_str(); | 997 const wchar_t* module_path = current_exe.value().c_str(); |
| 997 const size_t kChunkSize = 2 * 1024 * 1024; | 998 const size_t kChunkSize = 2 * 1024 * 1024; |
| 998 | 999 |
| 999 ASSERT_TRUE( | 1000 ASSERT_TRUE( |
| 1000 ImagePreReader::PartialPreReadImageOnDisk(module_path, 0, kChunkSize)); | 1001 ImagePreReader::PartialPreReadImageOnDisk(module_path, 0, kChunkSize)); |
| 1001 ASSERT_TRUE( | 1002 ASSERT_TRUE( |
| 1002 ImagePreReader::PartialPreReadImageOnDisk(module_path, 25, kChunkSize)); | 1003 ImagePreReader::PartialPreReadImageOnDisk(module_path, 25, kChunkSize)); |
| 1003 ASSERT_TRUE( | 1004 ASSERT_TRUE( |
| 1004 ImagePreReader::PartialPreReadImageOnDisk(module_path, 50, kChunkSize)); | 1005 ImagePreReader::PartialPreReadImageOnDisk(module_path, 50, kChunkSize)); |
| 1005 ASSERT_TRUE( | 1006 ASSERT_TRUE( |
| 1006 ImagePreReader::PartialPreReadImageOnDisk(module_path, 100, kChunkSize)); | 1007 ImagePreReader::PartialPreReadImageOnDisk(module_path, 100, kChunkSize)); |
| 1007 ASSERT_TRUE( | 1008 ASSERT_TRUE( |
| 1008 ImagePreReader::PartialPreReadImageOnDisk(module_path, 150, kChunkSize)); | 1009 ImagePreReader::PartialPreReadImageOnDisk(module_path, 150, kChunkSize)); |
| 1009 } | 1010 } |
| 1010 | 1011 |
| 1011 TEST(ImagePreReader, PartialPreReadImageInMemory) { | 1012 TEST(ImagePreReader, PartialPreReadImageInMemory) { |
| 1012 FilePath current_exe; | 1013 base::FilePath current_exe; |
| 1013 ASSERT_TRUE(PathService::Get(base::FILE_EXE, ¤t_exe)); | 1014 ASSERT_TRUE(PathService::Get(base::FILE_EXE, ¤t_exe)); |
| 1014 const wchar_t* module_path = current_exe.value().c_str(); | 1015 const wchar_t* module_path = current_exe.value().c_str(); |
| 1015 | 1016 |
| 1016 ASSERT_TRUE( | 1017 ASSERT_TRUE( |
| 1017 ImagePreReader::PartialPreReadImageInMemory(module_path, 0)); | 1018 ImagePreReader::PartialPreReadImageInMemory(module_path, 0)); |
| 1018 ASSERT_TRUE( | 1019 ASSERT_TRUE( |
| 1019 ImagePreReader::PartialPreReadImageInMemory(module_path, 25)); | 1020 ImagePreReader::PartialPreReadImageInMemory(module_path, 25)); |
| 1020 ASSERT_TRUE( | 1021 ASSERT_TRUE( |
| 1021 ImagePreReader::PartialPreReadImageInMemory(module_path, 50)); | 1022 ImagePreReader::PartialPreReadImageInMemory(module_path, 50)); |
| 1022 ASSERT_TRUE( | 1023 ASSERT_TRUE( |
| (...skipping 27 matching lines...) Expand all Loading... |
| 1050 true /* important */, false); | 1051 true /* important */, false); |
| 1051 } | 1052 } |
| 1052 | 1053 |
| 1053 TEST_F(ChromeFrameBinariesLoadTest, PerfWarm) { | 1054 TEST_F(ChromeFrameBinariesLoadTest, PerfWarm) { |
| 1054 RunStartupTest("binary_load_warm", "t", "", false /* cold */, 0, NULL, | 1055 RunStartupTest("binary_load_warm", "t", "", false /* cold */, 0, NULL, |
| 1055 true /* important */, false); | 1056 true /* important */, false); |
| 1056 } | 1057 } |
| 1057 | 1058 |
| 1058 TEST_F(ChromeFrameStartupTestActiveX, PerfCold) { | 1059 TEST_F(ChromeFrameStartupTestActiveX, PerfCold) { |
| 1059 SetConfigInt(L"PreRead", 0); | 1060 SetConfigInt(L"PreRead", 0); |
| 1060 FilePath binaries_to_evict[] = { | 1061 base::FilePath binaries_to_evict[] = { |
| 1061 ffmpegsumo_dll_, chrome_exe_, chrome_dll_, chrome_frame_dll_ | 1062 ffmpegsumo_dll_, chrome_exe_, chrome_dll_, chrome_frame_dll_ |
| 1062 }; | 1063 }; |
| 1063 RunStartupTest("cold", "t", "about:blank", true /* cold */, | 1064 RunStartupTest("cold", "t", "about:blank", true /* cold */, |
| 1064 arraysize(binaries_to_evict), binaries_to_evict, | 1065 arraysize(binaries_to_evict), binaries_to_evict, |
| 1065 false /* not important */, false); | 1066 false /* not important */, false); |
| 1066 DeleteConfigValue(L"PreRead"); | 1067 DeleteConfigValue(L"PreRead"); |
| 1067 } | 1068 } |
| 1068 | 1069 |
| 1069 TEST_F(ChromeFrameStartupTestActiveX, PerfColdPreRead) { | 1070 TEST_F(ChromeFrameStartupTestActiveX, PerfColdPreRead) { |
| 1070 SetConfigInt(L"PreRead", 1); | 1071 SetConfigInt(L"PreRead", 1); |
| 1071 FilePath binaries_to_evict[] = { | 1072 base::FilePath binaries_to_evict[] = { |
| 1072 ffmpegsumo_dll_, chrome_exe_, chrome_dll_, chrome_frame_dll_ | 1073 ffmpegsumo_dll_, chrome_exe_, chrome_dll_, chrome_frame_dll_ |
| 1073 }; | 1074 }; |
| 1074 RunStartupTest("cold_preread", "t", "about:blank", true /* cold */, | 1075 RunStartupTest("cold_preread", "t", "about:blank", true /* cold */, |
| 1075 arraysize(binaries_to_evict), binaries_to_evict, | 1076 arraysize(binaries_to_evict), binaries_to_evict, |
| 1076 false /* not important */, false); | 1077 false /* not important */, false); |
| 1077 DeleteConfigValue(L"PreRead"); | 1078 DeleteConfigValue(L"PreRead"); |
| 1078 } | 1079 } |
| 1079 | 1080 |
| 1080 TEST_F(ChromeFrameBinariesLoadTest, PerfCold) { | 1081 TEST_F(ChromeFrameBinariesLoadTest, PerfCold) { |
| 1081 FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; | 1082 base::FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; |
| 1082 RunStartupTest("binary_load_cold", "t", "", true /* cold */, | 1083 RunStartupTest("binary_load_cold", "t", "", true /* cold */, |
| 1083 arraysize(binaries_to_evict), binaries_to_evict, | 1084 arraysize(binaries_to_evict), binaries_to_evict, |
| 1084 false /* not important */, false); | 1085 false /* not important */, false); |
| 1085 } | 1086 } |
| 1086 | 1087 |
| 1087 TEST_F(ChromeFrameBinariesLoadTest, PerfColdPreRead) { | 1088 TEST_F(ChromeFrameBinariesLoadTest, PerfColdPreRead) { |
| 1088 FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; | 1089 base::FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; |
| 1089 pre_read_type_ = kPreReadFull; | 1090 pre_read_type_ = kPreReadFull; |
| 1090 RunStartupTest("binary_load_cold_preread", "t", "", true /* cold */, | 1091 RunStartupTest("binary_load_cold_preread", "t", "", true /* cold */, |
| 1091 arraysize(binaries_to_evict), binaries_to_evict, | 1092 arraysize(binaries_to_evict), binaries_to_evict, |
| 1092 false /* not important */, false); | 1093 false /* not important */, false); |
| 1093 } | 1094 } |
| 1094 | 1095 |
| 1095 TEST_F(ChromeFrameBinariesLoadTest, PerfColdPartialPreRead15) { | 1096 TEST_F(ChromeFrameBinariesLoadTest, PerfColdPartialPreRead15) { |
| 1096 FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; | 1097 base::FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; |
| 1097 pre_read_type_ = kPreReadPartial; | 1098 pre_read_type_ = kPreReadPartial; |
| 1098 percentage_to_preread_ = 15; | 1099 percentage_to_preread_ = 15; |
| 1099 RunStartupTest("binary_load_cold_partial_preread", "t", "", true /* cold */, | 1100 RunStartupTest("binary_load_cold_partial_preread", "t", "", true /* cold */, |
| 1100 arraysize(binaries_to_evict), binaries_to_evict, | 1101 arraysize(binaries_to_evict), binaries_to_evict, |
| 1101 false /* not important */, false); | 1102 false /* not important */, false); |
| 1102 } | 1103 } |
| 1103 | 1104 |
| 1104 | 1105 |
| 1105 TEST_F(ChromeFrameBinariesLoadTest, PerfColdPartialPreRead25) { | 1106 TEST_F(ChromeFrameBinariesLoadTest, PerfColdPartialPreRead25) { |
| 1106 FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; | 1107 base::FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; |
| 1107 pre_read_type_ = kPreReadPartial; | 1108 pre_read_type_ = kPreReadPartial; |
| 1108 percentage_to_preread_ = 25; | 1109 percentage_to_preread_ = 25; |
| 1109 RunStartupTest("binary_load_cold_partial_preread", "t", "", true /* cold */, | 1110 RunStartupTest("binary_load_cold_partial_preread", "t", "", true /* cold */, |
| 1110 arraysize(binaries_to_evict), binaries_to_evict, | 1111 arraysize(binaries_to_evict), binaries_to_evict, |
| 1111 false /* not important */, false); | 1112 false /* not important */, false); |
| 1112 } | 1113 } |
| 1113 | 1114 |
| 1114 TEST_F(ChromeFrameBinariesLoadTest, PerfColdPartialPreRead40) { | 1115 TEST_F(ChromeFrameBinariesLoadTest, PerfColdPartialPreRead40) { |
| 1115 FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; | 1116 base::FilePath binaries_to_evict[] = {chrome_exe_, chrome_dll_}; |
| 1116 pre_read_type_ = kPreReadPartial; | 1117 pre_read_type_ = kPreReadPartial; |
| 1117 percentage_to_preread_ = 40; | 1118 percentage_to_preread_ = 40; |
| 1118 RunStartupTest("binary_load_cold_partial_preread", "t", "", true /* cold */, | 1119 RunStartupTest("binary_load_cold_partial_preread", "t", "", true /* cold */, |
| 1119 arraysize(binaries_to_evict), binaries_to_evict, | 1120 arraysize(binaries_to_evict), binaries_to_evict, |
| 1120 false /* not important */, false); | 1121 false /* not important */, false); |
| 1121 } | 1122 } |
| 1122 | 1123 |
| 1123 TEST_F(ChromeFrameStartupTestActiveXReference, PerfWarm) { | 1124 TEST_F(ChromeFrameStartupTestActiveXReference, PerfWarm) { |
| 1124 RunStartupTest("warm", "t_ref", "about:blank", false /* cold */, 0, NULL, | 1125 RunStartupTest("warm", "t_ref", "about:blank", false /* cold */, 0, NULL, |
| 1125 true /* important */, false); | 1126 true /* important */, false); |
| 1126 } | 1127 } |
| 1127 | 1128 |
| 1128 TEST_F(ChromeFrameStartupTestActiveX, PerfChromeFrameInitializationWarm) { | 1129 TEST_F(ChromeFrameStartupTestActiveX, PerfChromeFrameInitializationWarm) { |
| 1129 RunStartupTest("ChromeFrame_init_warm", "t", "", false /* cold */, 0, | 1130 RunStartupTest("ChromeFrame_init_warm", "t", "", false /* cold */, 0, |
| 1130 NULL, true /* important */, false); | 1131 NULL, true /* important */, false); |
| 1131 } | 1132 } |
| 1132 | 1133 |
| 1133 TEST_F(ChromeFrameStartupTestActiveX, PerfChromeFrameInitializationCold) { | 1134 TEST_F(ChromeFrameStartupTestActiveX, PerfChromeFrameInitializationCold) { |
| 1134 FilePath binaries_to_evict[] = {chrome_frame_dll_}; | 1135 base::FilePath binaries_to_evict[] = {chrome_frame_dll_}; |
| 1135 RunStartupTest("ChromeFrame_init_cold", "t", "", true /* cold */, | 1136 RunStartupTest("ChromeFrame_init_cold", "t", "", true /* cold */, |
| 1136 arraysize(binaries_to_evict), binaries_to_evict, | 1137 arraysize(binaries_to_evict), binaries_to_evict, |
| 1137 false /* not important */, false); | 1138 false /* not important */, false); |
| 1138 } | 1139 } |
| 1139 | 1140 |
| 1140 TEST_F(ChromeFrameStartupTestActiveXReference, | 1141 TEST_F(ChromeFrameStartupTestActiveXReference, |
| 1141 PerfChromeFrameInitializationWarm) { | 1142 PerfChromeFrameInitializationWarm) { |
| 1142 RunStartupTest("ChromeFrame_init_warm", "t_ref", "", false /* cold */, 0, | 1143 RunStartupTest("ChromeFrame_init_warm", "t_ref", "", false /* cold */, 0, |
| 1143 NULL, true /* important */, false); | 1144 NULL, true /* important */, false); |
| 1144 } | 1145 } |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 RunStartupTest("creation_warm", "t_flash", "", false /* cold */, 0, NULL, | 1207 RunStartupTest("creation_warm", "t_flash", "", false /* cold */, 0, NULL, |
| 1207 true /* not important */, false); | 1208 true /* not important */, false); |
| 1208 } | 1209 } |
| 1209 | 1210 |
| 1210 TEST_F(SilverlightCreationTest, DISABLED_PerfWarm) { | 1211 TEST_F(SilverlightCreationTest, DISABLED_PerfWarm) { |
| 1211 RunStartupTest("creation_warm", "t_silverlight", "", false /* cold */, 0, | 1212 RunStartupTest("creation_warm", "t_silverlight", "", false /* cold */, 0, |
| 1212 NULL, false /* not important */, false); | 1213 NULL, false /* not important */, false); |
| 1213 } | 1214 } |
| 1214 | 1215 |
| 1215 TEST_F(ChromeFrameCreationTest, PerfCold) { | 1216 TEST_F(ChromeFrameCreationTest, PerfCold) { |
| 1216 FilePath binaries_to_evict[] = {chrome_frame_dll_}; | 1217 base::FilePath binaries_to_evict[] = {chrome_frame_dll_}; |
| 1217 | 1218 |
| 1218 RunStartupTest("creation_cold", "t", "", true /* cold */, | 1219 RunStartupTest("creation_cold", "t", "", true /* cold */, |
| 1219 arraysize(binaries_to_evict), binaries_to_evict, | 1220 arraysize(binaries_to_evict), binaries_to_evict, |
| 1220 true /* important */, false); | 1221 true /* important */, false); |
| 1221 } | 1222 } |
| 1222 | 1223 |
| 1223 // Attempt to evict the Flash control can fail on the buildbot as the dll | 1224 // Attempt to evict the Flash control can fail on the buildbot as the dll |
| 1224 // is marked read only. The test run is aborted if we fail to evict the file | 1225 // is marked read only. The test run is aborted if we fail to evict the file |
| 1225 // from the cache. This could also fail if the Flash control is in use. | 1226 // from the cache. This could also fail if the Flash control is in use. |
| 1226 // On Vista this could fail because of UAC | 1227 // On Vista this could fail because of UAC |
| 1227 TEST_F(FlashCreationTest, PerfCold) { | 1228 TEST_F(FlashCreationTest, PerfCold) { |
| 1228 base::win::RegKey flash_key(HKEY_CLASSES_ROOT, kFlashControlKey, KEY_READ); | 1229 base::win::RegKey flash_key(HKEY_CLASSES_ROOT, kFlashControlKey, KEY_READ); |
| 1229 | 1230 |
| 1230 std::wstring plugin_path; | 1231 std::wstring plugin_path; |
| 1231 ASSERT_EQ(ERROR_SUCCESS, flash_key.ReadValue(L"", &plugin_path)); | 1232 ASSERT_EQ(ERROR_SUCCESS, flash_key.ReadValue(L"", &plugin_path)); |
| 1232 ASSERT_FALSE(plugin_path.empty()); | 1233 ASSERT_FALSE(plugin_path.empty()); |
| 1233 | 1234 |
| 1234 FilePath flash_path = FilePath(plugin_path); | 1235 base::FilePath flash_path = base::FilePath(plugin_path); |
| 1235 FilePath binaries_to_evict[] = {flash_path}; | 1236 base::FilePath binaries_to_evict[] = {flash_path}; |
| 1236 | 1237 |
| 1237 RunStartupTest("creation_cold", "t_flash", "", true /* cold */, | 1238 RunStartupTest("creation_cold", "t_flash", "", true /* cold */, |
| 1238 arraysize(binaries_to_evict), binaries_to_evict, | 1239 arraysize(binaries_to_evict), binaries_to_evict, |
| 1239 false/* important */, true); | 1240 false/* important */, true); |
| 1240 } | 1241 } |
| 1241 | 1242 |
| 1242 // This test would fail on Vista due to UAC or if the Silverlight control is | 1243 // This test would fail on Vista due to UAC or if the Silverlight control is |
| 1243 // in use. The test run is aborted if we fail to evict the file from the cache. | 1244 // in use. The test run is aborted if we fail to evict the file from the cache. |
| 1244 // Disabling this test as the Silverlight dll does not seem to get unloaded | 1245 // Disabling this test as the Silverlight dll does not seem to get unloaded |
| 1245 // correctly causing the attempt to evict the dll from the system cache to | 1246 // correctly causing the attempt to evict the dll from the system cache to |
| 1246 // fail. | 1247 // fail. |
| 1247 TEST_F(SilverlightCreationTest, DISABLED_PerfCold) { | 1248 TEST_F(SilverlightCreationTest, DISABLED_PerfCold) { |
| 1248 base::win::RegKey silverlight_key(HKEY_CLASSES_ROOT, kSilverlightControlKey, | 1249 base::win::RegKey silverlight_key(HKEY_CLASSES_ROOT, kSilverlightControlKey, |
| 1249 KEY_READ); | 1250 KEY_READ); |
| 1250 | 1251 |
| 1251 std::wstring plugin_path; | 1252 std::wstring plugin_path; |
| 1252 ASSERT_EQ(ERROR_SUCCESS, silverlight_key.ReadValue(L"", &plugin_path)); | 1253 ASSERT_EQ(ERROR_SUCCESS, silverlight_key.ReadValue(L"", &plugin_path)); |
| 1253 ASSERT_FALSE(plugin_path.empty()); | 1254 ASSERT_FALSE(plugin_path.empty()); |
| 1254 | 1255 |
| 1255 FilePath silverlight_path = FilePath(plugin_path); | 1256 base::FilePath silverlight_path = base::FilePath(plugin_path); |
| 1256 FilePath binaries_to_evict[] = {silverlight_path}; | 1257 base::FilePath binaries_to_evict[] = {silverlight_path}; |
| 1257 | 1258 |
| 1258 RunStartupTest("creation_cold", "t_silverlight", "", true /* cold */, | 1259 RunStartupTest("creation_cold", "t_silverlight", "", true /* cold */, |
| 1259 arraysize(binaries_to_evict), binaries_to_evict, | 1260 arraysize(binaries_to_evict), binaries_to_evict, |
| 1260 false /* important */, true); | 1261 false /* important */, true); |
| 1261 } | 1262 } |
| 1262 | 1263 |
| 1263 namespace { | 1264 namespace { |
| 1264 | 1265 |
| 1265 // Derive from this class in order to receive custom events traced | 1266 // Derive from this class in order to receive custom events traced |
| 1266 // via TRACE_EVENT_XXXX macros from ChromeFrame/Chrome. | 1267 // via TRACE_EVENT_XXXX macros from ChromeFrame/Chrome. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1346 } | 1347 } |
| 1347 | 1348 |
| 1348 void AnalyzeOutput(TracedEvents* delegate) { | 1349 void AnalyzeOutput(TracedEvents* delegate) { |
| 1349 EtwConsumer consumer; | 1350 EtwConsumer consumer; |
| 1350 consumer.set_delegate(delegate); | 1351 consumer.set_delegate(delegate); |
| 1351 consumer.OpenFileSession(etl_log_file_.value().c_str()); | 1352 consumer.OpenFileSession(etl_log_file_.value().c_str()); |
| 1352 consumer.Consume(); | 1353 consumer.Consume(); |
| 1353 consumer.Close(); | 1354 consumer.Close(); |
| 1354 } | 1355 } |
| 1355 | 1356 |
| 1356 FilePath etl_log_file_; | 1357 base::FilePath etl_log_file_; |
| 1357 base::win::EtwTraceController controller_; | 1358 base::win::EtwTraceController controller_; |
| 1358 }; | 1359 }; |
| 1359 | 1360 |
| 1360 // Base class for the tracing event helper classes. | 1361 // Base class for the tracing event helper classes. |
| 1361 class MonitorTraceBase { | 1362 class MonitorTraceBase { |
| 1362 public: | 1363 public: |
| 1363 static bool IsMatchingEvent(EVENT_TRACE* event, | 1364 static bool IsMatchingEvent(EVENT_TRACE* event, |
| 1364 const base::StringPiece& event_to_compare) { | 1365 const base::StringPiece& event_to_compare) { |
| 1365 return event->MofLength > event_to_compare.size() && | 1366 return event->MofLength > event_to_compare.size() && |
| 1366 (memcmp(event_to_compare.data(), event->MofData, | 1367 (memcmp(event_to_compare.data(), event->MofData, |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 const std::string& modifier, | 1471 const std::string& modifier, |
| 1471 const std::string& trace, | 1472 const std::string& trace, |
| 1472 const std::string& values, | 1473 const std::string& values, |
| 1473 const std::string& units, | 1474 const std::string& units, |
| 1474 bool important) { | 1475 bool important) { |
| 1475 PrintResultsImpl(measurement, modifier, trace, values, | 1476 PrintResultsImpl(measurement, modifier, trace, values, |
| 1476 "[", "]", units, important); | 1477 "[", "]", units, important); |
| 1477 } | 1478 } |
| 1478 | 1479 |
| 1479 bool RunSingleTestOutOfProc(const std::string& test_name) { | 1480 bool RunSingleTestOutOfProc(const std::string& test_name) { |
| 1480 FilePath path; | 1481 base::FilePath path; |
| 1481 if (!PathService::Get(base::DIR_EXE, &path)) | 1482 if (!PathService::Get(base::DIR_EXE, &path)) |
| 1482 return false; | 1483 return false; |
| 1483 path = path.Append(L"chrome_frame_tests.exe"); | 1484 path = path.Append(L"chrome_frame_tests.exe"); |
| 1484 | 1485 |
| 1485 CommandLine cmd_line(path); | 1486 CommandLine cmd_line(path); |
| 1486 // Always enable disabled tests. This method is not called with disabled | 1487 // Always enable disabled tests. This method is not called with disabled |
| 1487 // tests unless this flag was specified to the browser test executable. | 1488 // tests unless this flag was specified to the browser test executable. |
| 1488 cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); | 1489 cmd_line.AppendSwitch("gtest_also_run_disabled_tests"); |
| 1489 cmd_line.AppendSwitchASCII("gtest_filter", test_name); | 1490 cmd_line.AppendSwitchASCII("gtest_filter", test_name); |
| 1490 | 1491 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1594 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles, | 1595 PrintPerfTestResults(automation_provider_connect_monitor, kNumCycles, |
| 1595 "automationproviderconnect"); | 1596 "automationproviderconnect"); |
| 1596 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles, | 1597 PrintPerfTestResults(external_tab_navigate_monitor, kNumCycles, |
| 1597 "externaltabnavigate"); | 1598 "externaltabnavigate"); |
| 1598 PrintPerfTestResults(renderer_main_monitor, kNumCycles, | 1599 PrintPerfTestResults(renderer_main_monitor, kNumCycles, |
| 1599 "beginrenderermain"); | 1600 "beginrenderermain"); |
| 1600 #ifdef NDEBUG | 1601 #ifdef NDEBUG |
| 1601 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage"); | 1602 PrintPerfTestResults(pre_read_chrome_monitor, kNumCycles, "PreReadImage"); |
| 1602 #endif // NDEBUG | 1603 #endif // NDEBUG |
| 1603 } | 1604 } |
| OLD | NEW |