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..17535ee3aaba8fe297e5affec20081d78fb6b9aa 100644 |
| --- a/ash/laser/laser_pointer_points_test_api.cc |
| +++ b/ash/laser/laser_pointer_points_test_api.cc |
| @@ -10,7 +10,7 @@ namespace ash { |
| LaserPointerPointsTestApi::LaserPointerPointsTestApi( |
| LaserPointerPoints* instance) |
| - : new_point_time_(base::Time::Now()), instance_(instance) {} |
| + : instance_(instance) {} |
| LaserPointerPointsTestApi::~LaserPointerPointsTestApi() {} |
| @@ -20,12 +20,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.creation_time = new_time; |
| instance_->points_.push_back(new_point); |
| - instance_->ClearOldPoints(); |
| + instance_->MoveForwardToTime(new_time); |
| } |
| + |
| +double LaserPointerPointsTestApi::AgeAtIndex(int index) { |
| + if (index >= GetNumberOfPoints()) |
|
jdufault
2016/10/04 22:04:13
DCHECK on this?
sammiequon
2016/10/05 17:42:23
Done.
|
| + return -1.0f; |
| + return instance_->points_[index].age; |
| +} |
| + |
| } // namespace ash |