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