| OLD | NEW | 
|    1 // Copyright 2013 The Chromium Authors. All rights reserved. |    1 // Copyright 2013 The Chromium Authors. All rights reserved. | 
|    2 // Use of this source code is governed by a BSD-style license that can be |    2 // Use of this source code is governed by a BSD-style license that can be | 
|    3 // found in the LICENSE file. |    3 // found in the LICENSE file. | 
|    4  |    4  | 
|    5 #include "cc/output/output_surface.h" |    5 #include "cc/output/output_surface.h" | 
|    6  |    6  | 
|    7 #include "base/test/test_simple_task_runner.h" |    7 #include "base/test/test_simple_task_runner.h" | 
|    8 #include "cc/debug/test_context_provider.h" |    8 #include "cc/debug/test_context_provider.h" | 
|    9 #include "cc/debug/test_web_graphics_context_3d.h" |    9 #include "cc/debug/test_web_graphics_context_3d.h" | 
|   10 #include "cc/output/managed_memory_policy.h" |   10 #include "cc/output/managed_memory_policy.h" | 
|   11 #include "cc/output/output_surface_client.h" |   11 #include "cc/output/output_surface_client.h" | 
|   12 #include "cc/output/software_output_device.h" |   12 #include "cc/output/software_output_device.h" | 
|   13 #include "cc/test/fake_output_surface.h" |   13 #include "cc/test/fake_output_surface.h" | 
|   14 #include "cc/test/fake_output_surface_client.h" |   14 #include "cc/test/fake_output_surface_client.h" | 
|   15 #include "cc/test/scheduler_test_common.h" |   15 #include "cc/test/scheduler_test_common.h" | 
|   16 #include "gpu/GLES2/gl2extchromium.h" |   16 #include "gpu/GLES2/gl2extchromium.h" | 
|   17 #include "testing/gtest/include/gtest/gtest.h" |   17 #include "testing/gtest/include/gtest/gtest.h" | 
 |   18 #include "ui/gfx/frame_time.h" | 
|   18  |   19  | 
|   19 namespace cc { |   20 namespace cc { | 
|   20 namespace { |   21 namespace { | 
|   21  |   22  | 
|   22 class TestOutputSurface : public OutputSurface { |   23 class TestOutputSurface : public OutputSurface { | 
|   23  public: |   24  public: | 
|   24   explicit TestOutputSurface(scoped_refptr<ContextProvider> context_provider) |   25   explicit TestOutputSurface(scoped_refptr<ContextProvider> context_provider) | 
|   25       : OutputSurface(context_provider), |   26       : OutputSurface(context_provider), | 
|   26         retroactive_begin_frame_deadline_enabled_(false), |   27         retroactive_begin_frame_deadline_enabled_(false), | 
|   27         override_retroactive_period_(false) {} |   28         override_retroactive_period_(false) {} | 
| (...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  375   const base::TimeDelta display_refresh_interval = big_interval; |  376   const base::TimeDelta display_refresh_interval = big_interval; | 
|  376  |  377  | 
|  377   output_surface.InitializeBeginFrameEmulation( |  378   output_surface.InitializeBeginFrameEmulation( | 
|  378       task_runner.get(), |  379       task_runner.get(), | 
|  379       throttle_frame_production, |  380       throttle_frame_production, | 
|  380       display_refresh_interval); |  381       display_refresh_interval); | 
|  381  |  382  | 
|  382   // We need to subtract an epsilon from Now() because some platforms have |  383   // We need to subtract an epsilon from Now() because some platforms have | 
|  383   // a slow clock. |  384   // a slow clock. | 
|  384   output_surface.OnVSyncParametersChangedForTesting( |  385   output_surface.OnVSyncParametersChangedForTesting( | 
|  385       base::TimeTicks::Now() - base::TimeDelta::FromSeconds(1), big_interval); |  386       gfx::FrameTime::Now() - base::TimeDelta::FromSeconds(1), big_interval); | 
|  386  |  387  | 
|  387   output_surface.SetMaxFramesPending(2); |  388   output_surface.SetMaxFramesPending(2); | 
|  388   output_surface.EnableRetroactiveBeginFrameDeadline(true, true, big_interval); |  389   output_surface.EnableRetroactiveBeginFrameDeadline(true, true, big_interval); | 
|  389  |  390  | 
|  390   // We should start off with 0 BeginFrames |  391   // We should start off with 0 BeginFrames | 
|  391   EXPECT_EQ(client.begin_frame_count(), 0); |  392   EXPECT_EQ(client.begin_frame_count(), 0); | 
|  392   EXPECT_EQ(output_surface.pending_swap_buffers(), 0); |  393   EXPECT_EQ(output_surface.pending_swap_buffers(), 0); | 
|  393  |  394  | 
|  394   // The first SetNeedsBeginFrame(true) should start a retroactive BeginFrame. |  395   // The first SetNeedsBeginFrame(true) should start a retroactive BeginFrame. | 
|  395   EXPECT_FALSE(task_runner->HasPendingTask()); |  396   EXPECT_FALSE(task_runner->HasPendingTask()); | 
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  477   EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); |  478   EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); | 
|  478   EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); |  479   EXPECT_EQ(0, software_output_device->discard_backbuffer_count()); | 
|  479   output_surface.DiscardBackbuffer(); |  480   output_surface.DiscardBackbuffer(); | 
|  480  |  481  | 
|  481   EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); |  482   EXPECT_EQ(1, software_output_device->ensure_backbuffer_count()); | 
|  482   EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); |  483   EXPECT_EQ(1, software_output_device->discard_backbuffer_count()); | 
|  483 } |  484 } | 
|  484  |  485  | 
|  485 }  // namespace |  486 }  // namespace | 
|  486 }  // namespace cc |  487 }  // namespace cc | 
| OLD | NEW |