OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if (disp_id != DISPID_READYSTATE) | 126 if (disp_id != DISPID_READYSTATE) |
127 return S_OK; | 127 return S_OK; |
128 | 128 |
129 long ready_state; | 129 long ready_state; |
130 HRESULT hr = tab_->get_readyState(&ready_state); | 130 HRESULT hr = tab_->get_readyState(&ready_state); |
131 DCHECK(hr == S_OK); | 131 DCHECK(hr == S_OK); |
132 | 132 |
133 OnReadyStateChanged(ready_state); | 133 OnReadyStateChanged(ready_state); |
134 | 134 |
135 if (ready_state == READYSTATE_COMPLETE) { | 135 if (ready_state == READYSTATE_COMPLETE) { |
136 if(!starting_url_.empty()) { | 136 if (!starting_url_.empty()) { |
137 Navigate(starting_url_.c_str()); | 137 Navigate(starting_url_.c_str()); |
138 } else { | 138 } else { |
139 PostMessage(WM_CLOSE); | 139 PostMessage(WM_CLOSE); |
140 } | 140 } |
141 } else if (ready_state == READYSTATE_UNINITIALIZED) { | 141 } else if (ready_state == READYSTATE_UNINITIALIZED) { |
142 DLOG(ERROR) << __FUNCTION__ << " Chrome launch failed."; | 142 DLOG(ERROR) << __FUNCTION__ << " Chrome launch failed."; |
143 } | 143 } |
144 | 144 |
145 return S_OK; | 145 return S_OK; |
146 } | 146 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 class ChromeFrameStartupTest : public ChromeFramePerfTestBase { | 279 class ChromeFrameStartupTest : public ChromeFramePerfTestBase { |
280 public: | 280 public: |
281 ChromeFrameStartupTest() {} | 281 ChromeFrameStartupTest() {} |
282 | 282 |
283 virtual void SetUp() { | 283 virtual void SetUp() { |
284 ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app_)); | 284 ASSERT_TRUE(PathService::Get(chrome::DIR_APP, &dir_app_)); |
285 | 285 |
286 chrome_dll_ = dir_app_.Append(FILE_PATH_LITERAL("chrome.dll")); | 286 chrome_dll_ = dir_app_.Append(FILE_PATH_LITERAL("chrome.dll")); |
287 chrome_exe_ = dir_app_.Append( | 287 chrome_exe_ = dir_app_.Append( |
288 FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName)); | 288 FilePath::FromWStringHack(chrome::kBrowserProcessExecutableName)); |
| 289 chrome_frame_dll_ = dir_app_.Append(FILE_PATH_LITERAL("servers")); |
289 chrome_frame_dll_ = dir_app_.Append( | 290 chrome_frame_dll_ = dir_app_.Append( |
290 FILE_PATH_LITERAL("servers\\npchrome_tab.dll")); | 291 FilePath::FromWStringHack(kChromeFrameDllName)); |
291 } | 292 } |
292 virtual void TearDown() {} | 293 virtual void TearDown() {} |
293 | 294 |
294 // TODO(iyengar) | 295 // TODO(iyengar) |
295 // This function is similar to the RunStartupTest function used in chrome | 296 // This function is similar to the RunStartupTest function used in chrome |
296 // startup tests. Refactor into a common implementation. | 297 // startup tests. Refactor into a common implementation. |
297 void RunStartupTest(const char* graph, const char* trace, | 298 void RunStartupTest(const char* graph, const char* trace, |
298 const char* startup_url, bool test_cold, | 299 const char* startup_url, bool test_cold, |
299 int total_binaries, const FilePath binaries_to_evict[], | 300 int total_binaries, const FilePath binaries_to_evict[], |
300 bool important, bool ignore_cache_error) { | 301 bool important, bool ignore_cache_error) { |
(...skipping 19 matching lines...) Expand all Loading... |
320 } | 321 } |
321 } | 322 } |
322 | 323 |
323 TimeTicks start_time, end_time; | 324 TimeTicks start_time, end_time; |
324 | 325 |
325 RunStartupTestImpl(&start_time, &end_time); | 326 RunStartupTestImpl(&start_time, &end_time); |
326 | 327 |
327 timings[i] = end_time - start_time; | 328 timings[i] = end_time - start_time; |
328 | 329 |
329 CoFreeUnusedLibraries(); | 330 CoFreeUnusedLibraries(); |
330 ASSERT_TRUE(GetModuleHandle(L"npchrome_tab.dll") == NULL); | 331 ASSERT_TRUE(GetModuleHandle(kChromeFrameDllName) == NULL); |
331 | 332 |
332 // TODO(beng): Can't shut down so quickly. Figure out why, and fix. If we | 333 // TODO(beng): Can't shut down so quickly. Figure out why, and fix. If we |
333 // do, we crash. | 334 // do, we crash. |
334 PlatformThread::Sleep(50); | 335 PlatformThread::Sleep(50); |
335 } | 336 } |
336 | 337 |
337 std::string times; | 338 std::string times; |
338 for (int i = 0; i < kNumCycles; ++i) | 339 for (int i = 0; i < kNumCycles; ++i) |
339 StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); | 340 StringAppendF(×, "%.2f,", timings[i].InMillisecondsF()); |
340 | 341 |
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
814 chrome_frame_container_->CreateChromeFrameWindow(url.c_str()); | 815 chrome_frame_container_->CreateChromeFrameWindow(url.c_str()); |
815 chrome_frame_container_->CreateControl(true); | 816 chrome_frame_container_->CreateControl(true); |
816 | 817 |
817 module.RunMessageLoop(); | 818 module.RunMessageLoop(); |
818 | 819 |
819 chrome_frame_container_->Release(); | 820 chrome_frame_container_->Release(); |
820 | 821 |
821 PrintResults(test_name_.c_str()); | 822 PrintResults(test_name_.c_str()); |
822 | 823 |
823 CoFreeUnusedLibraries(); | 824 CoFreeUnusedLibraries(); |
824 //ASSERT_TRUE(GetModuleHandle(L"npchrome_tab.dll") == NULL); | |
825 } | 825 } |
826 | 826 |
827 void NavigateImpl(const std::string& url) { | 827 void NavigateImpl(const std::string& url) { |
828 ASSERT_TRUE(chrome_frame_container_ != NULL); | 828 ASSERT_TRUE(chrome_frame_container_ != NULL); |
829 ASSERT_TRUE(!url.empty()); | 829 ASSERT_TRUE(!url.empty()); |
830 chrome_frame_container_->Navigate(url.c_str()); | 830 chrome_frame_container_->Navigate(url.c_str()); |
831 } | 831 } |
832 | 832 |
833 void TestCompleted() { | 833 void TestCompleted() { |
834 // This can get called multiple times if the last url results in a | 834 // This can get called multiple times if the last url results in a |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 ASSERT_TRUE(silverlight_key.ReadValue(L"", &plugin_path)); | 1103 ASSERT_TRUE(silverlight_key.ReadValue(L"", &plugin_path)); |
1104 ASSERT_FALSE(plugin_path.empty()); | 1104 ASSERT_FALSE(plugin_path.empty()); |
1105 | 1105 |
1106 FilePath silverlight_path = FilePath::FromWStringHack(plugin_path); | 1106 FilePath silverlight_path = FilePath::FromWStringHack(plugin_path); |
1107 FilePath binaries_to_evict[] = {silverlight_path}; | 1107 FilePath binaries_to_evict[] = {silverlight_path}; |
1108 | 1108 |
1109 RunStartupTest("creation_cold", "t_silverlight", "", true /* cold */, | 1109 RunStartupTest("creation_cold", "t_silverlight", "", true /* cold */, |
1110 arraysize(binaries_to_evict), binaries_to_evict, | 1110 arraysize(binaries_to_evict), binaries_to_evict, |
1111 false /* important */, true); | 1111 false /* important */, true); |
1112 } | 1112 } |
OLD | NEW |