Commit 390884a8 authored by mithro@mithis.com's avatar mithro@mithis.com

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
parent a7a1c83a
......@@ -120,6 +120,8 @@
'cc_tests_support_files': [
'test/animation_test_common.cc',
'test/animation_test_common.h',
'test/begin_frame_args_test.cc',
'test/begin_frame_args_test.h',
'test/fake_content_layer.cc',
'test/fake_content_layer.h',
'test/fake_content_layer_client.cc',
......
......@@ -35,20 +35,6 @@ BeginFrameArgs BeginFrameArgs::CreateForSynchronousCompositor() {
DefaultInterval());
}
BeginFrameArgs BeginFrameArgs::CreateForTesting() {
base::TimeTicks now = gfx::FrameTime::Now();
return BeginFrameArgs(now,
now + (DefaultInterval() / 2),
DefaultInterval());
}
BeginFrameArgs BeginFrameArgs::CreateExpiredForTesting() {
base::TimeTicks now = gfx::FrameTime::Now();
return BeginFrameArgs(now,
now - DefaultInterval(),
DefaultInterval());
}
// This is a hard-coded deadline adjustment that assumes 60Hz, to be used in
// cases where a good estimated draw time is not known. Using 1/3 of the vsync
// as the default adjustment gives the Browser the last 1/3 of a frame to
......
......@@ -20,8 +20,6 @@ struct CC_EXPORT BeginFrameArgs {
base::TimeTicks deadline,
base::TimeDelta interval);
static BeginFrameArgs CreateForSynchronousCompositor();
static BeginFrameArgs CreateForTesting();
static BeginFrameArgs CreateExpiredForTesting();
// This is the default delta that will be used to adjust the deadline when
// proper draw-time estimations are not yet available.
......
......@@ -8,6 +8,7 @@
#include "cc/output/managed_memory_policy.h"
#include "cc/output/output_surface_client.h"
#include "cc/output/software_output_device.h"
#include "cc/test/begin_frame_args_test.h"
#include "cc/test/fake_output_surface.h"
#include "cc/test/fake_output_surface_client.h"
#include "cc/test/scheduler_test_common.h"
......@@ -45,7 +46,7 @@ class TestOutputSurface : public OutputSurface {
}
void BeginFrameForTesting() {
client_->BeginFrame(BeginFrameArgs::CreateExpiredForTesting());
client_->BeginFrame(CreateExpiredBeginFrameArgsForTesting());
}
void DidSwapBuffersForTesting() { client_->DidSwapBuffers(); }
......
This diff is collapsed.
// 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
// 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_
......@@ -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());
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment