| 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 | 4 |
| 5 #include "base/basictypes.h" | 5 #include "base/basictypes.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 } | 123 } |
| 124 VLOG(1) << "Buffer cache should be primed with " << loaded << " files."; | 124 VLOG(1) << "Buffer cache should be primed with " << loaded << " files."; |
| 125 } | 125 } |
| 126 | 126 |
| 127 class PageCyclerTest : public UIPerfTest { | 127 class PageCyclerTest : public UIPerfTest { |
| 128 public: | 128 public: |
| 129 PageCyclerTest() : print_times_only_(false), | 129 PageCyclerTest() : print_times_only_(false), |
| 130 num_test_iterations_(kTestIterations) { | 130 num_test_iterations_(kTestIterations) { |
| 131 show_window_ = true; | 131 show_window_ = true; |
| 132 dom_automation_enabled_ = true; | 132 dom_automation_enabled_ = true; |
| 133 stats_collection_extension_enabled_ = true; |
| 133 | 134 |
| 134 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); | 135 const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); |
| 135 if (parsed_command_line.HasSwitch(switches::kPageCyclerIterations)) { | 136 if (parsed_command_line.HasSwitch(switches::kPageCyclerIterations)) { |
| 136 std::string str = parsed_command_line.GetSwitchValueASCII( | 137 std::string str = parsed_command_line.GetSwitchValueASCII( |
| 137 switches::kPageCyclerIterations); | 138 switches::kPageCyclerIterations); |
| 138 base::StringToInt(str, &num_test_iterations_); | 139 base::StringToInt(str, &num_test_iterations_); |
| 139 } | 140 } |
| 140 } | 141 } |
| 141 | 142 |
| 142 virtual void SetLaunchSwitches() OVERRIDE { | 143 virtual void SetLaunchSwitches() OVERRIDE { |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 271 |
| 271 private: | 272 private: |
| 272 void PrintMemoryHistogram(const std::string& name, | 273 void PrintMemoryHistogram(const std::string& name, |
| 273 const std::string& units) { | 274 const std::string& units) { |
| 274 scoped_refptr<TabProxy> tab(GetActiveTab()); | 275 scoped_refptr<TabProxy> tab(GetActiveTab()); |
| 275 ASSERT_TRUE(tab.get()); | 276 ASSERT_TRUE(tab.get()); |
| 276 std::wstring whistogram; | 277 std::wstring whistogram; |
| 277 ASSERT_TRUE(tab->ExecuteAndExtractString( | 278 ASSERT_TRUE(tab->ExecuteAndExtractString( |
| 278 L"", | 279 L"", |
| 279 L"window.domAutomationController.send(" | 280 L"window.domAutomationController.send(" |
| 280 L"window.domAutomationController.getHistogram ? " | 281 L"window.statsCollectionExtension.getHistogram ? " |
| 281 L"window.domAutomationController.getHistogram(\"" + | 282 L"window.statsCollectionExtension.getHistogram(\"" + |
| 282 base::SysUTF8ToWide(name) + L"\") : '')", | 283 base::SysUTF8ToWide(name) + L"\") : '')", |
| 283 &whistogram)); | 284 &whistogram)); |
| 284 std::string histogram = base::SysWideToNativeMB(whistogram); | 285 std::string histogram = base::SysWideToNativeMB(whistogram); |
| 285 printf("HISTOGRAM %s: %s = %s %s\n", | 286 printf("HISTOGRAM %s: %s = %s %s\n", |
| 286 name.c_str(), name.c_str(), histogram.c_str(), units.c_str()); | 287 name.c_str(), name.c_str(), histogram.c_str(), units.c_str()); |
| 287 } | 288 } |
| 288 | 289 |
| 289 void PrintMemoryHistograms() { | 290 void PrintMemoryHistograms() { |
| 290 ASSERT_NO_FATAL_FAILURE(PrintMemoryHistogram( | 291 ASSERT_NO_FATAL_FAILURE(PrintMemoryHistogram( |
| 291 "V8.MemoryExternalFragmentationTotal", "percent")); | 292 "V8.MemoryExternalFragmentationTotal", "percent")); |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 677 TEST_F(PageCyclerAccessibilityTest, MozFileWithAccessibilityEnabled) { | 678 TEST_F(PageCyclerAccessibilityTest, MozFileWithAccessibilityEnabled) { |
| 678 num_test_iterations_ = 1; | 679 num_test_iterations_ = 1; |
| 679 RunTest("times", "moz", false); | 680 RunTest("times", "moz", false); |
| 680 } | 681 } |
| 681 | 682 |
| 682 TEST_F(PageCyclerAccessibilityTest, MorejsFileWithAccessibilityEnabled) { | 683 TEST_F(PageCyclerAccessibilityTest, MorejsFileWithAccessibilityEnabled) { |
| 683 RunTest("times", "morejs", false); | 684 RunTest("times", "morejs", false); |
| 684 } | 685 } |
| 685 | 686 |
| 686 } // namespace | 687 } // namespace |
| OLD | NEW |