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

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

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master Created 4 years, 8 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/common_decoder.h ('k') | gpu/command_buffer/service/context_group.h » ('j') | 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>
9
8 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 10 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
9 #include "gpu/command_buffer/service/common_decoder.h" 11 #include "gpu/command_buffer/service/common_decoder.h"
10 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
11 13
12 namespace gpu { 14 namespace gpu {
13 15
14 TEST(CommonDecoderBucket, Basic) { 16 TEST(CommonDecoderBucket, Basic) {
15 CommonDecoder::Bucket bucket; 17 CommonDecoder::Bucket bucket;
16 EXPECT_EQ(0u, bucket.size()); 18 EXPECT_EQ(0u, bucket.size());
17 EXPECT_TRUE(NULL == bucket.GetData(0, 0)); 19 EXPECT_TRUE(NULL == bucket.GetData(0, 0));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 static const int32_t kValidShmId = 2; 78 static const int32_t kValidShmId = 2;
77 static const int32_t kInvalidShmId = 3; 79 static const int32_t kInvalidShmId = 3;
78 static const size_t kBufferSize = 1024; 80 static const size_t kBufferSize = 1024;
79 static const int32_t kValidOffset = kBufferSize / 2; 81 static const int32_t kValidOffset = kBufferSize / 2;
80 static const int32_t kInvalidOffset = kBufferSize; 82 static const int32_t kInvalidOffset = kBufferSize;
81 83
82 MockCommandBufferEngine() 84 MockCommandBufferEngine()
83 : CommandBufferEngine(), 85 : CommandBufferEngine(),
84 token_(), 86 token_(),
85 get_offset_(0) { 87 get_offset_(0) {
86 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); 88 std::unique_ptr<base::SharedMemory> shared_memory(new base::SharedMemory());
87 shared_memory->CreateAndMapAnonymous(kBufferSize); 89 shared_memory->CreateAndMapAnonymous(kBufferSize);
88 buffer_ = MakeBufferFromSharedMemory(std::move(shared_memory), kBufferSize); 90 buffer_ = MakeBufferFromSharedMemory(std::move(shared_memory), kBufferSize);
89 } 91 }
90 92
91 // Overridden from CommandBufferEngine. 93 // Overridden from CommandBufferEngine.
92 scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32_t shm_id) override { 94 scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32_t shm_id) override {
93 if (IsValidSharedMemoryId(shm_id)) 95 if (IsValidSharedMemoryId(shm_id))
94 return buffer_; 96 return buffer_;
95 return NULL; 97 return NULL;
96 } 98 }
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory); 503 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory);
502 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 504 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
503 505
504 // Check that it fails if the size is invalid 506 // Check that it fails if the size is invalid
505 cmd.Init(kBucketId, 0, sizeof(kData) + 1, 507 cmd.Init(kBucketId, 0, sizeof(kData) + 1,
506 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory); 508 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory);
507 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 509 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
508 } 510 }
509 511
510 } // namespace gpu 512 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/common_decoder.h ('k') | gpu/command_buffer/service/context_group.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698