Chromium Code Reviews| Index: ash/laser/laser_pointer_points_test_api.cc |
| diff --git a/ash/laser/laser_pointer_points_test_api.cc b/ash/laser/laser_pointer_points_test_api.cc |
| index 5180731128d1e4e18a4c0622ffcd3b7c241b252f..9ba6c897b52502399befc649836e44bb431aa8e1 100644 |
| --- a/ash/laser/laser_pointer_points_test_api.cc |
| +++ b/ash/laser/laser_pointer_points_test_api.cc |
| @@ -4,13 +4,11 @@ |
| #include "ash/laser/laser_pointer_points_test_api.h" |
| -#include "ash/laser/laser_pointer_points.h" |
| - |
| namespace ash { |
| LaserPointerPointsTestApi::LaserPointerPointsTestApi( |
| LaserPointerPoints* instance) |
| - : new_point_time_(base::Time::Now()), instance_(instance) {} |
| + : instance_(instance) {} |
| LaserPointerPointsTestApi::~LaserPointerPointsTestApi() {} |
| @@ -20,12 +18,18 @@ int LaserPointerPointsTestApi::GetNumberOfPoints() const { |
| void LaserPointerPointsTestApi::MoveForwardInTime( |
| const base::TimeDelta& delta) { |
| - for (LaserPointerPoints::LaserPoint& point : instance_->points_) |
| - point.creation_time -= delta; |
| + base::Time new_time = instance_->collection_latest_time_ + delta; |
| LaserPointerPoints::LaserPoint new_point; |
| - new_point.creation_time = new_point_time_; |
| + new_point.age = 0.0; |
| + instance_->MoveForwardToTime(new_time); |
|
jdufault
2016/10/05 21:36:05
Keep new_point initialization together; move the M
sammiequon
2016/10/06 00:19:16
Done.
|
| instance_->points_.push_back(new_point); |
| - instance_->ClearOldPoints(); |
| } |
| + |
| +LaserPointerPoints::LaserPoint LaserPointerPointsTestApi::GetPointAtIndex( |
| + int index) { |
| + DCHECK(index >= GetNumberOfPoints()); |
|
jdufault
2016/10/05 21:36:05
Is this DCHECK right? It looks like it is inverted
sammiequon
2016/10/06 00:19:15
Done.
|
| + return instance_->points_[index]; |
| +} |
| + |
| } // namespace ash |