| Index: cc/test/layer_tree_test.cc
|
| diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc
|
| index 5c85d160670ea09459dbc904a343a6d0fbccda96..a83013ff25f4beace303e075a40f749c9d41d8f4 100644
|
| --- a/cc/test/layer_tree_test.cc
|
| +++ b/cc/test/layer_tree_test.cc
|
| @@ -25,6 +25,7 @@
|
| #include "cc/trees/layer_tree_host_single_thread_client.h"
|
| #include "cc/trees/layer_tree_impl.h"
|
| #include "cc/trees/single_thread_proxy.h"
|
| +#include "cc/trees/thread_proxy.h"
|
| #include "testing/gmock/include/gmock/gmock.h"
|
| #include "ui/gfx/frame_time.h"
|
| #include "ui/gfx/size_conversions.h"
|
| @@ -46,6 +47,33 @@ base::TimeDelta TestHooks::LowFrequencyAnimationInterval() const {
|
| return base::TimeDelta::FromMilliseconds(16);
|
| }
|
|
|
| +// Adapts ThreadProxy for test. Injects test hooks for testing.
|
| +class ThreadProxyForTest : public ThreadProxy {
|
| + public:
|
| + static scoped_ptr<Proxy> Create(
|
| + TestHooks* test_hooks,
|
| + LayerTreeHost* host,
|
| + scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
|
| + return make_scoped_ptr(
|
| + new ThreadProxyForTest(test_hooks,
|
| + host,
|
| + impl_task_runner)).PassAs<Proxy>();
|
| + }
|
| +
|
| + virtual ~ThreadProxyForTest() {}
|
| +
|
| + private:
|
| + TestHooks* test_hooks_;
|
| +
|
| + ThreadProxyForTest(
|
| + TestHooks* test_hooks,
|
| + LayerTreeHost* host,
|
| + scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
|
| + : ThreadProxy(host, impl_task_runner),
|
| + test_hooks_(test_hooks) {
|
| + }
|
| +};
|
| +
|
| // Adapts LayerTreeHostImpl for test. Runs real code, then invokes test hooks.
|
| class LayerTreeHostImplForTesting : public LayerTreeHostImpl {
|
| public:
|
| @@ -320,6 +348,12 @@ class LayerTreeHostForTesting : public LayerTreeHost {
|
|
|
| virtual void DidDeferCommit() OVERRIDE { test_hooks_->DidDeferCommit(); }
|
|
|
| + virtual void InitializeThreaded(
|
| + scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) OVERRIDE {
|
| + InitializeProxy(
|
| + ThreadProxyForTest::Create(test_hooks_, this, impl_task_runner));
|
| + }
|
| +
|
| private:
|
| LayerTreeHostForTesting(TestHooks* test_hooks,
|
| LayerTreeHostClient* client,
|
|
|