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

Side by Side Diff: gpu/command_buffer/client/fenced_allocator_test.cc

Issue 465099: Removed command buffer's last dependency on NPAPI.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 22 matching lines...) Expand all
33 // This file contains the tests for the FencedAllocator class. 33 // This file contains the tests for the FencedAllocator class.
34 34
35 #include "base/at_exit.h" 35 #include "base/at_exit.h"
36 #include "base/message_loop.h" 36 #include "base/message_loop.h"
37 #include "gpu/command_buffer/client/cmd_buffer_helper.h" 37 #include "gpu/command_buffer/client/cmd_buffer_helper.h"
38 #include "gpu/command_buffer/client/fenced_allocator.h" 38 #include "gpu/command_buffer/client/fenced_allocator.h"
39 #include "gpu/command_buffer/service/cmd_buffer_engine.h" 39 #include "gpu/command_buffer/service/cmd_buffer_engine.h"
40 #include "gpu/command_buffer/service/mocks.h" 40 #include "gpu/command_buffer/service/mocks.h"
41 #include "gpu/command_buffer/service/command_buffer_service.h" 41 #include "gpu/command_buffer/service/command_buffer_service.h"
42 #include "gpu/command_buffer/service/gpu_processor.h" 42 #include "gpu/command_buffer/service/gpu_processor.h"
43 #include "gpu/np_utils/np_browser_stub.h"
44 #include "gpu/np_utils/np_object_pointer.h"
45 #include "testing/gtest/include/gtest/gtest.h" 43 #include "testing/gtest/include/gtest/gtest.h"
46 44
47 namespace command_buffer { 45 namespace command_buffer {
48 46
49 using command_buffer::CommandBufferService; 47 using command_buffer::CommandBufferService;
50 using command_buffer::GPUProcessor; 48 using command_buffer::GPUProcessor;
51 using np_utils::NPCreateObject;
52 using np_utils::NPObjectPointer;
53 using testing::Return; 49 using testing::Return;
54 using testing::Mock; 50 using testing::Mock;
55 using testing::Truly; 51 using testing::Truly;
56 using testing::Sequence; 52 using testing::Sequence;
57 using testing::DoAll; 53 using testing::DoAll;
58 using testing::Invoke; 54 using testing::Invoke;
59 using testing::_; 55 using testing::_;
60 56
61 class BaseFencedAllocatorTest : public testing::Test { 57 class BaseFencedAllocatorTest : public testing::Test {
62 protected: 58 protected:
63 static const unsigned int kBufferSize = 1024; 59 static const unsigned int kBufferSize = 1024;
64 60
65 virtual void SetUp() { 61 virtual void SetUp() {
66 api_mock_.reset(new AsyncAPIMock); 62 api_mock_.reset(new AsyncAPIMock);
67 // ignore noops in the mock - we don't want to inspect the internals of the 63 // ignore noops in the mock - we don't want to inspect the internals of the
68 // helper. 64 // helper.
69 EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _)) 65 EXPECT_CALL(*api_mock_, DoCommand(cmd::kNoop, 0, _))
70 .WillRepeatedly(Return(parse_error::kParseNoError)); 66 .WillRepeatedly(Return(parse_error::kParseNoError));
71 // Forward the SetToken calls to the engine 67 // Forward the SetToken calls to the engine
72 EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _)) 68 EXPECT_CALL(*api_mock_.get(), DoCommand(cmd::kSetToken, 1, _))
73 .WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken), 69 .WillRepeatedly(DoAll(Invoke(api_mock_.get(), &AsyncAPIMock::SetToken),
74 Return(parse_error::kParseNoError))); 70 Return(parse_error::kParseNoError)));
75 71
76 ::base::SharedMemory* ring_buffer = new ::base::SharedMemory; 72 base::SharedMemory* ring_buffer = new base::SharedMemory;
77 ring_buffer->Create(std::wstring(), false, false, 1024); 73 ring_buffer->Create(std::wstring(), false, false, 1024);
78 ring_buffer->Map(1024); 74 ring_buffer->Map(1024);
79 75
80 command_buffer_.reset(new CommandBufferService); 76 command_buffer_.reset(new CommandBufferService);
81 command_buffer_->Initialize(ring_buffer); 77 command_buffer_->Initialize(ring_buffer);
82 78
83 parser_ = new command_buffer::CommandParser(ring_buffer->memory(), 79 parser_ = new command_buffer::CommandParser(ring_buffer->memory(),
84 kBufferSize, 80 kBufferSize,
85 0, 81 0,
86 kBufferSize, 82 kBufferSize,
(...skipping 10 matching lines...) Expand all
97 helper_.reset(new CommandBufferHelper(command_buffer_.get())); 93 helper_.reset(new CommandBufferHelper(command_buffer_.get()));
98 helper_->Initialize(); 94 helper_->Initialize();
99 } 95 }
100 96
101 virtual void TearDown() { 97 virtual void TearDown() {
102 helper_.release(); 98 helper_.release();
103 } 99 }
104 100
105 base::AtExitManager at_exit_manager_; 101 base::AtExitManager at_exit_manager_;
106 MessageLoop message_loop_; 102 MessageLoop message_loop_;
107 np_utils::StubNPBrowser browser_;
108 scoped_ptr<AsyncAPIMock> api_mock_; 103 scoped_ptr<AsyncAPIMock> api_mock_;
109 scoped_ptr<CommandBufferService> command_buffer_; 104 scoped_ptr<CommandBufferService> command_buffer_;
110 command_buffer::CommandParser* parser_; 105 command_buffer::CommandParser* parser_;
111 scoped_ptr<CommandBufferHelper> helper_; 106 scoped_ptr<CommandBufferHelper> helper_;
112 }; 107 };
113 108
114 #ifndef COMPILER_MSVC 109 #ifndef COMPILER_MSVC
115 const unsigned int BaseFencedAllocatorTest::kBufferSize; 110 const unsigned int BaseFencedAllocatorTest::kBufferSize;
116 #endif 111 #endif
117 112
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 EXPECT_LE(token, command_buffer_->GetToken()); 487 EXPECT_LE(token, command_buffer_->GetToken());
493 488
494 // Free up everything. 489 // Free up everything.
495 for (unsigned int i = 0; i < kAllocCount; ++i) { 490 for (unsigned int i = 0; i < kAllocCount; ++i) {
496 allocator_->Free(pointers[i]); 491 allocator_->Free(pointers[i]);
497 EXPECT_TRUE(allocator_->CheckConsistency()); 492 EXPECT_TRUE(allocator_->CheckConsistency());
498 } 493 }
499 } 494 }
500 495
501 } // namespace command_buffer 496 } // namespace command_buffer
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/cmd_buffer_helper_test.cc ('k') | gpu/command_buffer/client/gles2_demo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698