| 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" |
| (...skipping 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 analyzer_->FindEvents(query_swaps_, &events); | 539 analyzer_->FindEvents(query_swaps_, &events); |
| 540 RateStats stats; | 540 RateStats stats; |
| 541 ASSERT_TRUE(GetRateStats(events, &stats)); | 541 ASSERT_TRUE(GetRateStats(events, &stats)); |
| 542 | 542 |
| 543 // Check that the number of swaps is close to kNumFrames. | 543 // Check that the number of swaps is close to kNumFrames. |
| 544 EXPECT_LT(num_frames_ - num_frames_ / 4, static_cast<int>(events.size())); | 544 EXPECT_LT(num_frames_ - num_frames_ / 4, static_cast<int>(events.size())); |
| 545 *frame_time = static_cast<int>(stats.mean_us); | 545 *frame_time = static_cast<int>(stats.mean_us); |
| 546 } | 546 } |
| 547 | 547 |
| 548 void LatencyTest::SendInput() { | 548 void LatencyTest::SendInput() { |
| 549 RenderViewHost* rvh = browser()->GetSelectedTabContentsWrapper()-> | 549 content::RenderViewHost* rvh = browser()->GetSelectedTabContentsWrapper()-> |
| 550 web_contents()->GetRenderViewHost(); | 550 web_contents()->GetRenderViewHost(); |
| 551 WebKit::WebMouseEvent mouse_event; | 551 WebKit::WebMouseEvent mouse_event; |
| 552 mouse_event.movementX = 1; | 552 mouse_event.movementX = 1; |
| 553 mouse_x_ += mouse_event.movementX; | 553 mouse_x_ += mouse_event.movementX; |
| 554 // Wrap mouse_x_ when it's near the edge of the tab. | 554 // Wrap mouse_x_ when it's near the edge of the tab. |
| 555 if (mouse_x_ > tab_width_ - 5) | 555 if (mouse_x_ > tab_width_ - 5) |
| 556 mouse_x_ = 1; | 556 mouse_x_ = 1; |
| 557 mouse_event.x = mouse_event.windowX = mouse_x_; | 557 mouse_event.x = mouse_event.windowX = mouse_x_; |
| 558 // Set y coordinate to be a few pixels down from the top of the window, | 558 // Set y coordinate to be a few pixels down from the top of the window, |
| 559 // so that it is between the top and bottom of the canvas. | 559 // so that it is between the top and bottom of the canvas. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 613 INSTANTIATE_TEST_CASE_P(, LatencyTest, ::testing::Values( | 613 INSTANTIATE_TEST_CASE_P(, LatencyTest, ::testing::Values( |
| 614 0, | 614 0, |
| 615 kInputHeavy, | 615 kInputHeavy, |
| 616 kInputHeavy | kInputDirty | kRafHeavy, | 616 kInputHeavy | kInputDirty | kRafHeavy, |
| 617 kInputHeavy | kInputDirty | kRafHeavy | kPaintHeavy, | 617 kInputHeavy | kInputDirty | kRafHeavy | kPaintHeavy, |
| 618 kInputDirty | kPaintHeavy, | 618 kInputDirty | kPaintHeavy, |
| 619 kInputDirty | kRafHeavy | kPaintHeavy | 619 kInputDirty | kRafHeavy | kPaintHeavy |
| 620 )); | 620 )); |
| 621 | 621 |
| 622 } // namespace | 622 } // namespace |
| OLD | NEW |