OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/mac/scoped_nsautorelease_pool.h" | |
6 #include "base/message_loop.h" | 5 #include "base/message_loop.h" |
7 #include "gpu/command_buffer/common/command_buffer_mock.h" | 6 #include "gpu/command_buffer/common/command_buffer_mock.h" |
8 #include "gpu/command_buffer/service/gpu_scheduler.h" | 7 #include "gpu/command_buffer/service/gpu_scheduler.h" |
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
10 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
11 #include "gpu/command_buffer/service/mocks.h" | 10 #include "gpu/command_buffer/service/mocks.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
14 | 13 |
| 14 #if defined(OS_MACOSX) |
| 15 #include "base/mac/scoped_nsautorelease_pool.h" |
| 16 #endif |
| 17 |
15 using testing::_; | 18 using testing::_; |
16 using testing::DoAll; | 19 using testing::DoAll; |
17 using testing::Invoke; | 20 using testing::Invoke; |
18 using testing::NiceMock; | 21 using testing::NiceMock; |
19 using testing::Return; | 22 using testing::Return; |
20 using testing::SetArgumentPointee; | 23 using testing::SetArgumentPointee; |
21 using testing::StrictMock; | 24 using testing::StrictMock; |
22 | 25 |
23 namespace gpu { | 26 namespace gpu { |
24 | 27 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 virtual void TearDown() { | 66 virtual void TearDown() { |
64 // Ensure that any unexpected tasks posted by the GPU scheduler are executed | 67 // Ensure that any unexpected tasks posted by the GPU scheduler are executed |
65 // in order to fail the test. | 68 // in order to fail the test. |
66 MessageLoop::current()->RunAllPending(); | 69 MessageLoop::current()->RunAllPending(); |
67 } | 70 } |
68 | 71 |
69 error::Error GetError() { | 72 error::Error GetError() { |
70 return command_buffer_->GetState().error; | 73 return command_buffer_->GetState().error; |
71 } | 74 } |
72 | 75 |
| 76 #if defined(OS_MACOSX) |
73 base::mac::ScopedNSAutoreleasePool autorelease_pool_; | 77 base::mac::ScopedNSAutoreleasePool autorelease_pool_; |
| 78 #endif |
74 MessageLoop message_loop; | 79 MessageLoop message_loop; |
75 scoped_ptr<MockCommandBuffer> command_buffer_; | 80 scoped_ptr<MockCommandBuffer> command_buffer_; |
76 scoped_ptr<base::SharedMemory> shared_memory_; | 81 scoped_ptr<base::SharedMemory> shared_memory_; |
77 Buffer shared_memory_buffer_; | 82 Buffer shared_memory_buffer_; |
78 int32* buffer_; | 83 int32* buffer_; |
79 scoped_ptr<gles2::MockGLES2Decoder> decoder_; | 84 scoped_ptr<gles2::MockGLES2Decoder> decoder_; |
80 CommandParser* parser_; | 85 CommandParser* parser_; |
81 scoped_ptr<AsyncAPIMock> async_api_; | 86 scoped_ptr<AsyncAPIMock> async_api_; |
82 scoped_ptr<GpuScheduler> scheduler_; | 87 scoped_ptr<GpuScheduler> scheduler_; |
83 }; | 88 }; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 | 198 |
194 EXPECT_EQ(kRingBufferSize, scheduler_->GetSharedMemoryBuffer(7).size); | 199 EXPECT_EQ(kRingBufferSize, scheduler_->GetSharedMemoryBuffer(7).size); |
195 } | 200 } |
196 | 201 |
197 TEST_F(GpuSchedulerTest, SetTokenForwardsToCommandBuffer) { | 202 TEST_F(GpuSchedulerTest, SetTokenForwardsToCommandBuffer) { |
198 EXPECT_CALL(*command_buffer_, SetToken(7)); | 203 EXPECT_CALL(*command_buffer_, SetToken(7)); |
199 scheduler_->set_token(7); | 204 scheduler_->set_token(7); |
200 } | 205 } |
201 | 206 |
202 } // namespace gpu | 207 } // namespace gpu |
OLD | NEW |