Index: cc/trees/layer_tree_host_unittest_proxy.cc |
diff --git a/cc/trees/layer_tree_host_unittest_proxy.cc b/cc/trees/layer_tree_host_unittest_proxy.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4e7e0ec1aa629845760120ca1f2ca3bbcfeadc93 |
--- /dev/null |
+++ b/cc/trees/layer_tree_host_unittest_proxy.cc |
@@ -0,0 +1,70 @@ |
+// 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 "base/basictypes.h" |
+#include "base/compiler_specific.h" |
+#include "cc/test/layer_tree_test.h" |
+#include "cc/trees/thread_proxy.h" |
+ |
+#define THREAD_PROXY_NO_IMPL_TEST_F(TEST_FIXTURE_NAME) \ |
+ TEST_F(TEST_FIXTURE_NAME, Run_MainThreadPaint) { \ |
+ RunTest(false); \ |
+ } |
+ |
+#define THREAD_PROXY_TEST_F(TEST_FIXTURE_NAME) \ |
+ THREAD_PROXY_NO_IMPL_TEST_F(TEST_FIXTURE_NAME); \ |
+ TEST_F(TEST_FIXTURE_NAME, Run_ImplSidePaint) { \ |
+ RunTest(true); \ |
+ } |
+ |
+namespace cc { |
+ |
+class ThreadProxyTest : public LayerTreeTest { |
+ public: |
+ ThreadProxyTest() {} |
+ virtual ~ThreadProxyTest() {} |
+ |
+ void RunTest(bool impl_side_painting) { |
+ bool threaded = true; |
+ // We don't need to care about delegating mode. |
+ bool delegating_renderer = true; |
+ LayerTreeTest::RunTest(threaded, delegating_renderer, impl_side_painting); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(ThreadProxyTest); |
+}; |
+ |
+class ThreadProxyTestSetNeedsCommit : public ThreadProxyTest { |
+ public: |
+ void BeginTest() OVERRIDE { |
+ EXPECT_FALSE(ThreadProxyMainOnly().commit_requested); |
+ EXPECT_FALSE(ThreadProxyMainOnly().commit_request_sent_to_impl_thread); |
+ |
+ proxy()->SetNeedsCommit(); |
+ |
+ EXPECT_TRUE(ThreadProxyMainOnly().commit_requested); |
+ EXPECT_TRUE(ThreadProxyMainOnly().commit_request_sent_to_impl_thread); |
+ } |
+ |
+ void DidBeginMainFrame() OVERRIDE { |
+ EXPECT_FALSE(ThreadProxyMainOnly().commit_requested); |
+ EXPECT_FALSE(ThreadProxyMainOnly().commit_request_sent_to_impl_thread); |
+ |
+ EndTest(); |
+ } |
+ |
+ void AfterTest() OVERRIDE {} |
+ |
+ protected: |
+ ThreadProxyTestSetNeedsCommit() {} |
+ virtual ~ThreadProxyTestSetNeedsCommit() {} |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(ThreadProxyTestSetNeedsCommit); |
+}; |
+ |
+THREAD_PROXY_TEST_F(ThreadProxyTestSetNeedsCommit); |
+ |
+} // namespace cc |