| Index: cc/debug/micro_benchmark_controller_unittest.cc
|
| diff --git a/cc/debug/micro_benchmark_controller_unittest.cc b/cc/debug/micro_benchmark_controller_unittest.cc
|
| index e1d8d1e2da1ef4b8378624176fc60c8e3d609722..4894947a6da493a6875eaba09fef121b538ec263 100644
|
| --- a/cc/debug/micro_benchmark_controller_unittest.cc
|
| +++ b/cc/debug/micro_benchmark_controller_unittest.cc
|
| @@ -9,6 +9,7 @@
|
| #include "cc/layers/layer.h"
|
| #include "cc/resources/resource_update_queue.h"
|
| #include "cc/test/fake_layer_tree_host.h"
|
| +#include "cc/test/fake_layer_tree_host_impl.h"
|
| #include "cc/test/fake_proxy.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
|
|
| @@ -17,14 +18,25 @@ namespace {
|
|
|
| class MicroBenchmarkControllerTest : public testing::Test {
|
| public:
|
| - virtual void SetUp() {
|
| + virtual void SetUp() OVERRIDE {
|
| + impl_proxy_ = make_scoped_ptr(new FakeImplProxy);
|
| + layer_tree_host_impl_ =
|
| + make_scoped_ptr(new FakeLayerTreeHostImpl(impl_proxy_.get()));
|
| +
|
| layer_tree_host_ = FakeLayerTreeHost::Create();
|
| layer_tree_host_->SetRootLayer(Layer::Create());
|
| - layer_tree_host_->InitializeForTesting(
|
| - scoped_ptr<Proxy>(new FakeProxy));
|
| + layer_tree_host_->InitializeForTesting(scoped_ptr<Proxy>(new FakeProxy));
|
| + }
|
| +
|
| + virtual void TearDown() OVERRIDE {
|
| + layer_tree_host_impl_.reset();
|
| + layer_tree_host_.reset();
|
| + impl_proxy_.reset();
|
| }
|
|
|
| scoped_ptr<FakeLayerTreeHost> layer_tree_host_;
|
| + scoped_ptr<FakeLayerTreeHostImpl> layer_tree_host_impl_;
|
| + scoped_ptr<FakeImplProxy> impl_proxy_;
|
| };
|
|
|
| void Noop(scoped_ptr<base::Value> value) {
|
| @@ -100,5 +112,30 @@ TEST_F(MicroBenchmarkControllerTest, MultipleBenchmarkRan) {
|
| EXPECT_EQ(4, run_count);
|
| }
|
|
|
| +TEST_F(MicroBenchmarkControllerTest, BenchmarkImplRan) {
|
| + int run_count = 0;
|
| + scoped_ptr<base::DictionaryValue> settings(new base::DictionaryValue);
|
| + settings->SetBoolean("run_benchmark_impl", true);
|
| +
|
| + // Schedule a main thread benchmark.
|
| + bool result = layer_tree_host_->ScheduleMicroBenchmark(
|
| + "unittest_only_benchmark",
|
| + settings.PassAs<base::Value>(),
|
| + base::Bind(&IncrementCallCount, base::Unretained(&run_count)));
|
| + EXPECT_TRUE(result);
|
| +
|
| + // Schedule impl benchmarks. In production code, this is run in commit.
|
| + layer_tree_host_->GetMicroBenchmarkController()->ScheduleImplBenchmarks(
|
| + layer_tree_host_impl_.get());
|
| +
|
| + // Now complete the commit (as if on the impl thread).
|
| + layer_tree_host_impl_->CommitComplete();
|
| +
|
| + // Make sure all posted messages run.
|
| + base::MessageLoop::current()->RunUntilIdle();
|
| +
|
| + EXPECT_EQ(1, run_count);
|
| +}
|
| +
|
| } // namespace
|
| } // namespace cc
|
|
|