Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: gpu/command_buffer/service/command_buffer_service_unittest.cc

Issue 2304813002: command buffers: correctly handle Flush(num_entries) (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 int32_t GetGetOffset() { return command_buffer_->GetLastState().get_offset; } 40 int32_t GetGetOffset() { return command_buffer_->GetLastState().get_offset; }
41 41
42 int32_t GetPutOffset() { return command_buffer_->GetPutOffset(); } 42 int32_t GetPutOffset() { return command_buffer_->GetPutOffset(); }
43 43
44 int32_t GetToken() { return command_buffer_->GetLastState().token; } 44 int32_t GetToken() { return command_buffer_->GetLastState().token; }
45 45
46 int32_t GetError() { return command_buffer_->GetLastState().error; } 46 int32_t GetError() { return command_buffer_->GetLastState().error; }
47 47
48 bool Initialize(size_t size) { 48 bool Initialize(size_t entries) {
49 size_t size = entries * sizeof(CommandBufferEntry);
49 int32_t id; 50 int32_t id;
50 command_buffer_->CreateTransferBuffer(size, &id); 51 command_buffer_->CreateTransferBuffer(size, &id);
51 EXPECT_GT(id, 0); 52 EXPECT_GT(id, 0);
52 command_buffer_->SetGetBuffer(id); 53 command_buffer_->SetGetBuffer(id);
53 return true; 54 return true;
54 } 55 }
55 56
56 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_; 57 scoped_refptr<TransferBufferManagerInterface> transfer_buffer_manager_;
57 std::unique_ptr<CommandBufferService> command_buffer_; 58 std::unique_ptr<CommandBufferService> command_buffer_;
58 }; 59 };
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 144
144 TEST_F(CommandBufferServiceTest, DefaultParseErrorIsNoError) { 145 TEST_F(CommandBufferServiceTest, DefaultParseErrorIsNoError) {
145 EXPECT_EQ(0, GetError()); 146 EXPECT_EQ(0, GetError());
146 } 147 }
147 148
148 TEST_F(CommandBufferServiceTest, CanSetParseError) { 149 TEST_F(CommandBufferServiceTest, CanSetParseError) {
149 command_buffer_->SetParseError(error::kInvalidSize); 150 command_buffer_->SetParseError(error::kInvalidSize);
150 EXPECT_EQ(1, GetError()); 151 EXPECT_EQ(1, GetError());
151 } 152 }
152 } // namespace gpu 153 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/command_buffer_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698