Index: ash/common/system/chromeos/palette/tools/laser_pointer_testapis.cc |
diff --git a/ash/common/system/chromeos/palette/tools/laser_pointer_testapis.cc b/ash/common/system/chromeos/palette/tools/laser_pointer_testapis.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d01e18e2804ee34d127cdb20818250a84a443ecb |
--- /dev/null |
+++ b/ash/common/system/chromeos/palette/tools/laser_pointer_testapis.cc |
@@ -0,0 +1,56 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "ash/common/system/chromeos/palette/tools/laser_pointer_testapis.h" |
+ |
+#include "ash/common/system/chromeos/palette/tools/laser_pointer_mode.h" |
+#include "ash/common/system/chromeos/palette/tools/laser_pointer_view.h" |
+ |
+namespace ash { |
+ |
+LaserPointerPointsTestApi::LaserPointerPointsTestApi( |
+ std::unique_ptr<LaserPointerPoints> instance) |
+ : instance_(std::move(instance)) {} |
+ |
+LaserPointerPointsTestApi::~LaserPointerPointsTestApi() {} |
+ |
+int LaserPointerPointsTestApi::get_number_of_points() const { |
jdufault
2016/08/23 02:11:25
Keep method names the same: GetNumberOfPoints()
sammiequon
2016/08/23 19:30:02
Done.
|
+ return instance_->GetNumberOfPoints(); |
+} |
+ |
+void LaserPointerPointsTestApi::MoveForwardInTime(const base::TimeDelta& delta, |
+ const base::Time& time, |
+ const gfx::Point& location) { |
+ for (LaserPointerPoints::LaserPoint& point : instance_->points_) |
+ point.creation_time -= delta; |
+ |
+ LaserPointerPoints::LaserPoint new_point; |
+ new_point.creation_time = time; |
+ new_point.location = location; |
+ instance_->points_.push_back(new_point); |
+ instance_->ClearOldPoints(); |
+} |
+ |
+LaserPointerModeTestApi::LaserPointerModeTestApi( |
+ std::unique_ptr<LaserPointerMode> instance) |
+ : instance_(std::move(instance)) {} |
+ |
+LaserPointerModeTestApi::~LaserPointerModeTestApi() {} |
+ |
+void LaserPointerModeTestApi::OnEnable() { |
+ instance_->OnEnable(); |
+} |
+ |
+void LaserPointerModeTestApi::OnDisable() { |
+ instance_->OnDisable(); |
+} |
+ |
+const LaserPointerPoints& LaserPointerModeTestApi::laser_points() { |
+ return instance_->laser_pointer_view_->laser_points_; |
+} |
+ |
+gfx::Point LaserPointerModeTestApi::current_mouse_location() { |
+ return instance_->current_mouse_location_; |
+} |
+} // namespace ash |