| 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| 11 #include "base/test/test_switches.h" | 11 #include "base/test/test_switches.h" |
| 12 #include "base/test/trace_event_analyzer.h" | 12 #include "base/test/trace_event_analyzer.h" |
| 13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "base/timer.h" | 14 #include "base/timer.h" |
| 15 #include "base/version.h" | 15 #include "base/version.h" |
| 16 #include "chrome/browser/ui/browser.h" | 16 #include "chrome/browser/ui/browser.h" |
| 17 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 17 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 18 #include "chrome/common/chrome_paths.h" | 18 #include "chrome/common/chrome_paths.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/test/base/tracing.h" | 20 #include "chrome/test/base/tracing.h" |
| 21 #include "chrome/test/base/ui_test_utils.h" | 21 #include "chrome/test/base/ui_test_utils.h" |
| 22 #include "chrome/test/perf/browser_perf_test.h" | 22 #include "chrome/test/perf/browser_perf_test.h" |
| 23 #include "chrome/test/perf/perf_test.h" | 23 #include "chrome/test/perf/perf_test.h" |
| 24 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
| 25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
| 26 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
| 27 #include "content/test/gpu/gpu_test_config.h" | 27 #include "content/test/gpu/gpu_test_config.h" |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 analyzer_->FindEvents(query_end_swaps_, &events); | 593 analyzer_->FindEvents(query_end_swaps_, &events); |
| 594 RateStats stats; | 594 RateStats stats; |
| 595 ASSERT_TRUE(GetRateStats(events, &stats, NULL)); | 595 ASSERT_TRUE(GetRateStats(events, &stats, NULL)); |
| 596 | 596 |
| 597 // Check that the number of swaps is close to kNumFrames. | 597 // Check that the number of swaps is close to kNumFrames. |
| 598 EXPECT_LT(num_frames_ - num_frames_ / 4, static_cast<int>(events.size())); | 598 EXPECT_LT(num_frames_ - num_frames_ / 4, static_cast<int>(events.size())); |
| 599 *frame_time = static_cast<int>(stats.mean_us); | 599 *frame_time = static_cast<int>(stats.mean_us); |
| 600 } | 600 } |
| 601 | 601 |
| 602 void LatencyTest::SendInput() { | 602 void LatencyTest::SendInput() { |
| 603 content::RenderViewHost* rvh = browser()->GetSelectedTabContentsWrapper()-> | 603 content::RenderViewHost* rvh = |
| 604 web_contents()->GetRenderViewHost(); | 604 browser()->GetActiveWebContents()->GetRenderViewHost(); |
| 605 WebKit::WebMouseEvent mouse_event; | 605 WebKit::WebMouseEvent mouse_event; |
| 606 mouse_event.movementX = 1; | 606 mouse_event.movementX = 1; |
| 607 mouse_x_ += mouse_event.movementX; | 607 mouse_x_ += mouse_event.movementX; |
| 608 // Wrap mouse_x_ when it's near the edge of the tab. | 608 // Wrap mouse_x_ when it's near the edge of the tab. |
| 609 if (mouse_x_ > tab_width_ - 5) | 609 if (mouse_x_ > tab_width_ - 5) |
| 610 mouse_x_ = 1; | 610 mouse_x_ = 1; |
| 611 mouse_event.x = mouse_event.windowX = mouse_x_; | 611 mouse_event.x = mouse_event.windowX = mouse_x_; |
| 612 // Set y coordinate to be a few pixels down from the top of the window, | 612 // Set y coordinate to be a few pixels down from the top of the window, |
| 613 // so that it is between the top and bottom of the canvas. | 613 // so that it is between the top and bottom of the canvas. |
| 614 mouse_event.y = mouse_event.windowY = 5; | 614 mouse_event.y = mouse_event.windowY = 5; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 INSTANTIATE_TEST_CASE_P(, LatencyTest, ::testing::Values( | 667 INSTANTIATE_TEST_CASE_P(, LatencyTest, ::testing::Values( |
| 668 0, | 668 0, |
| 669 kInputHeavy, | 669 kInputHeavy, |
| 670 kInputHeavy | kInputDirty | kRafHeavy, | 670 kInputHeavy | kInputDirty | kRafHeavy, |
| 671 kInputHeavy | kInputDirty | kRafHeavy | kPaintHeavy, | 671 kInputHeavy | kInputDirty | kRafHeavy | kPaintHeavy, |
| 672 kInputDirty | kPaintHeavy, | 672 kInputDirty | kPaintHeavy, |
| 673 kInputDirty | kRafHeavy | kPaintHeavy | 673 kInputDirty | kRafHeavy | kPaintHeavy |
| 674 )); | 674 )); |
| 675 | 675 |
| 676 } // namespace | 676 } // namespace |
| OLD | NEW |