OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 // Tests for the Command Buffer Helper. | 5 // Tests for the Command Buffer Helper. |
6 | 6 |
7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/scoped_nsautorelease_pool.h" | 10 #include "base/scoped_nsautorelease_pool.h" |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 | 58 |
59 api_mock_->set_engine(gpu_processor_.get()); | 59 api_mock_->set_engine(gpu_processor_.get()); |
60 | 60 |
61 helper_.reset(new CommandBufferHelper(command_buffer_.get())); | 61 helper_.reset(new CommandBufferHelper(command_buffer_.get())); |
62 helper_->Initialize(); | 62 helper_->Initialize(); |
63 } | 63 } |
64 | 64 |
65 virtual void TearDown() { | 65 virtual void TearDown() { |
66 // If the GPUProcessor posts any tasks, this forces them to run. | 66 // If the GPUProcessor posts any tasks, this forces them to run. |
67 MessageLoop::current()->RunAllPending(); | 67 MessageLoop::current()->RunAllPending(); |
68 helper_.release(); | |
69 } | 68 } |
70 | 69 |
71 // Adds a command to the buffer through the helper, while adding it as an | 70 // Adds a command to the buffer through the helper, while adding it as an |
72 // expected call on the API mock. | 71 // expected call on the API mock. |
73 void AddCommandWithExpect(error::Error _return, | 72 void AddCommandWithExpect(error::Error _return, |
74 unsigned int command, | 73 unsigned int command, |
75 int arg_count, | 74 int arg_count, |
76 CommandBufferEntry *args) { | 75 CommandBufferEntry *args) { |
77 CommandHeader header; | 76 CommandHeader header; |
78 header.size = arg_count + 1; | 77 header.size = arg_count + 1; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 helper_->Finish(); | 274 helper_->Finish(); |
276 | 275 |
277 // Check that the commands did happen. | 276 // Check that the commands did happen. |
278 Mock::VerifyAndClearExpectations(api_mock_.get()); | 277 Mock::VerifyAndClearExpectations(api_mock_.get()); |
279 | 278 |
280 // Check the error status. | 279 // Check the error status. |
281 EXPECT_EQ(error::kNoError, GetError()); | 280 EXPECT_EQ(error::kNoError, GetError()); |
282 } | 281 } |
283 | 282 |
284 } // namespace gpu | 283 } // namespace gpu |
OLD | NEW |