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

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: undo part of clang-format 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
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
no sievers 2016/04/05 19:02:40 #include <memory>
Mostyn Bramley-Moore 2016/04/05 21:35:31 Done.
8 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 8 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
9 #include "gpu/command_buffer/service/common_decoder.h" 9 #include "gpu/command_buffer/service/common_decoder.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 11
12 namespace gpu { 12 namespace gpu {
13 13
14 TEST(CommonDecoderBucket, Basic) { 14 TEST(CommonDecoderBucket, Basic) {
15 CommonDecoder::Bucket bucket; 15 CommonDecoder::Bucket bucket;
16 EXPECT_EQ(0u, bucket.size()); 16 EXPECT_EQ(0u, bucket.size());
17 EXPECT_TRUE(NULL == bucket.GetData(0, 0)); 17 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; 76 static const int32_t kValidShmId = 2;
77 static const int32_t kInvalidShmId = 3; 77 static const int32_t kInvalidShmId = 3;
78 static const size_t kBufferSize = 1024; 78 static const size_t kBufferSize = 1024;
79 static const int32_t kValidOffset = kBufferSize / 2; 79 static const int32_t kValidOffset = kBufferSize / 2;
80 static const int32_t kInvalidOffset = kBufferSize; 80 static const int32_t kInvalidOffset = kBufferSize;
81 81
82 MockCommandBufferEngine() 82 MockCommandBufferEngine()
83 : CommandBufferEngine(), 83 : CommandBufferEngine(),
84 token_(), 84 token_(),
85 get_offset_(0) { 85 get_offset_(0) {
86 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); 86 std::unique_ptr<base::SharedMemory> shared_memory(new base::SharedMemory());
87 shared_memory->CreateAndMapAnonymous(kBufferSize); 87 shared_memory->CreateAndMapAnonymous(kBufferSize);
88 buffer_ = MakeBufferFromSharedMemory(std::move(shared_memory), kBufferSize); 88 buffer_ = MakeBufferFromSharedMemory(std::move(shared_memory), kBufferSize);
89 } 89 }
90 90
91 // Overridden from CommandBufferEngine. 91 // Overridden from CommandBufferEngine.
92 scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32_t shm_id) override { 92 scoped_refptr<gpu::Buffer> GetSharedMemoryBuffer(int32_t shm_id) override {
93 if (IsValidSharedMemoryId(shm_id)) 93 if (IsValidSharedMemoryId(shm_id))
94 return buffer_; 94 return buffer_;
95 return NULL; 95 return NULL;
96 } 96 }
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory); 501 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory);
502 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 502 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
503 503
504 // Check that it fails if the size is invalid 504 // Check that it fails if the size is invalid
505 cmd.Init(kBucketId, 0, sizeof(kData) + 1, 505 cmd.Init(kBucketId, 0, sizeof(kData) + 1,
506 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory); 506 MockCommandBufferEngine::kValidShmId, kSomeOffsetInSharedMemory);
507 EXPECT_NE(error::kNoError, ExecuteCmd(cmd)); 507 EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
508 } 508 }
509 509
510 } // namespace gpu 510 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698