summaryrefslogtreecommitdiffstats
path: root/cc/test
diff options
context:
space:
mode:
authormithro@mithis.com <mithro@mithis.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-10 01:50:39 +0000
committermithro@mithis.com <mithro@mithis.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-10 01:50:39 +0000
commit390884a85bc5b0615f415ad9ad5a7b27694e4e24 (patch)
tree3743102249304fd24835edce2b8954e4fed77ac8 /cc/test
parenta7a1c83a1fab0b235777ae65a5cb864e8fd9d9f0 (diff)
downloadchromium_src-390884a85bc5b0615f415ad9ad5a7b27694e4e24.zip
chromium_src-390884a85bc5b0615f415ad9ad5a7b27694e4e24.tar.gz
chromium_src-390884a85bc5b0615f415ad9ad5a7b27694e4e24.tar.bz2
Refactoring the debug creation of BeginFrameArgs objects to be in unittest code only.
Adding an output_test_common.xx file which will also gain more testing features for BeginFrameArgs soon. BUG=371223 Review URL: https://codereview.chromium.org/275543004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@269474 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/test')
-rw-r--r--cc/test/begin_frame_args_test.cc35
-rw-r--r--cc/test/begin_frame_args_test.h24
-rw-r--r--cc/test/fake_output_surface.cc3
3 files changed, 61 insertions, 1 deletions
diff --git a/cc/test/begin_frame_args_test.cc b/cc/test/begin_frame_args_test.cc
new file mode 100644
index 0000000..4565a94
--- /dev/null
+++ b/cc/test/begin_frame_args_test.cc
@@ -0,0 +1,35 @@
+// Copyright 2014 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 "cc/test/begin_frame_args_test.h"
+
+#include "base/time/time.h"
+#include "cc/output/begin_frame_args.h"
+#include "ui/gfx/frame_time.h"
+
+namespace cc {
+
+BeginFrameArgs CreateBeginFrameArgsForTesting() {
+ base::TimeTicks now = gfx::FrameTime::Now();
+ return BeginFrameArgs::Create(now,
+ now + (BeginFrameArgs::DefaultInterval() / 2),
+ BeginFrameArgs::DefaultInterval());
+}
+
+BeginFrameArgs CreateBeginFrameArgsForTesting(int64 frame_time,
+ int64 deadline,
+ int64 interval) {
+ return BeginFrameArgs::Create(base::TimeTicks::FromInternalValue(frame_time),
+ base::TimeTicks::FromInternalValue(deadline),
+ base::TimeDelta::FromInternalValue(interval));
+}
+
+BeginFrameArgs CreateExpiredBeginFrameArgsForTesting() {
+ base::TimeTicks now = gfx::FrameTime::Now();
+ return BeginFrameArgs::Create(now,
+ now - BeginFrameArgs::DefaultInterval(),
+ BeginFrameArgs::DefaultInterval());
+}
+
+} // namespace cc
diff --git a/cc/test/begin_frame_args_test.h b/cc/test/begin_frame_args_test.h
new file mode 100644
index 0000000..47a6c80
--- /dev/null
+++ b/cc/test/begin_frame_args_test.h
@@ -0,0 +1,24 @@
+// Copyright 2014 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.
+
+#ifndef CC_TEST_BEGIN_FRAME_ARGS_TEST_H_
+#define CC_TEST_BEGIN_FRAME_ARGS_TEST_H_
+
+#include <iosfwd>
+
+#include "base/time/time.h"
+#include "cc/output/begin_frame_args.h"
+
+namespace cc {
+
+// Functions for quickly creating BeginFrameArgs
+BeginFrameArgs CreateBeginFrameArgsForTesting();
+BeginFrameArgs CreateBeginFrameArgsForTesting(int64 frame_time,
+ int64 deadline,
+ int64 interval);
+BeginFrameArgs CreateExpiredBeginFrameArgsForTesting();
+
+} // namespace cc
+
+#endif // CC_TEST_BEGIN_FRAME_ARGS_TEST_H_
diff --git a/cc/test/fake_output_surface.cc b/cc/test/fake_output_surface.cc
index 352b6e4..3346b56 100644
--- a/cc/test/fake_output_surface.cc
+++ b/cc/test/fake_output_surface.cc
@@ -9,6 +9,7 @@
#include "cc/output/compositor_frame_ack.h"
#include "cc/output/output_surface_client.h"
#include "cc/resources/returned_resource.h"
+#include "cc/test/begin_frame_args_test.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace cc {
@@ -98,7 +99,7 @@ void FakeOutputSurface::SetNeedsBeginFrame(bool enable) {
}
void FakeOutputSurface::OnBeginFrame() {
- client_->BeginFrame(BeginFrameArgs::CreateForTesting());
+ client_->BeginFrame(CreateBeginFrameArgsForTesting());
}