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

Side by Side Diff: o3d/gpu_plugin/gpu_plugin_object_unittest.cc

Issue 196032: Replaced BaseNPObject with DefaultNPObject because...... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 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 | Annotate | Revision Log
« no previous file with comments | « o3d/gpu_plugin/gpu_plugin_object_factory.cc ('k') | o3d/gpu_plugin/gpu_plugin_unittest.cc » ('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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "o3d/gpu_plugin/command_buffer_mock.h" 5 #include "o3d/gpu_plugin/command_buffer_mock.h"
6 #include "o3d/gpu_plugin/gpu_plugin_object.h" 6 #include "o3d/gpu_plugin/gpu_plugin_object.h"
7 #include "o3d/gpu_plugin/np_utils/base_np_object_mock.h"
8 #include "o3d/gpu_plugin/np_utils/np_browser_mock.h" 7 #include "o3d/gpu_plugin/np_utils/np_browser_mock.h"
8 #include "o3d/gpu_plugin/np_utils/np_object_mock.h"
9 #include "o3d/gpu_plugin/np_utils/np_object_pointer.h" 9 #include "o3d/gpu_plugin/np_utils/np_object_pointer.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "webkit/glue/plugins/nphostapi.h" 12 #include "webkit/glue/plugins/nphostapi.h"
13 13
14 using testing::_; 14 using testing::_;
15 using testing::DoAll; 15 using testing::DoAll;
16 using testing::Return; 16 using testing::Return;
17 using testing::SetArgumentPointee; 17 using testing::SetArgumentPointee;
18 using testing::StrictMock; 18 using testing::StrictMock;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 TEST_F(GPUPluginObjectTest, CanGetScriptableNPObject) { 101 TEST_F(GPUPluginObjectTest, CanGetScriptableNPObject) {
102 EXPECT_EQ(plugin_object_.Get(), plugin_object_->GetScriptableNPObject()); 102 EXPECT_EQ(plugin_object_.Get(), plugin_object_->GetScriptableNPObject());
103 } 103 }
104 104
105 TEST_F(GPUPluginObjectTest, OpenCommandBufferReturnsInitializedCommandBuffer) { 105 TEST_F(GPUPluginObjectTest, OpenCommandBufferReturnsInitializedCommandBuffer) {
106 // Intercept creation of command buffer object and return mock. 106 // Intercept creation of command buffer object and return mock.
107 NPObjectPointer<MockCommandBuffer> command_buffer_object = 107 NPObjectPointer<MockCommandBuffer> command_buffer_object =
108 NPCreateObject<StrictMock<MockCommandBuffer> >(NULL); 108 NPCreateObject<StrictMock<MockCommandBuffer> >(NULL);
109 EXPECT_CALL(mock_browser_, CreateObject(NULL, 109 EXPECT_CALL(mock_browser_, CreateObject(NULL,
110 BaseNPObject::GetNPClass<CommandBuffer>())) 110 NPGetClass<CommandBuffer>()))
111 .WillOnce(Return(command_buffer_object.ToReturned())); 111 .WillOnce(Return(command_buffer_object.ToReturned()));
112 112
113 EXPECT_CALL(*command_buffer_object.Get(), Initialize(1024)) 113 EXPECT_CALL(*command_buffer_object.Get(), Initialize(1024))
114 .WillOnce(Return(true)); 114 .WillOnce(Return(true));
115 115
116 EXPECT_EQ(NPERR_NO_ERROR, plugin_object_->New("application/foo", 116 EXPECT_EQ(NPERR_NO_ERROR, plugin_object_->New("application/foo",
117 0, 117 0,
118 NULL, 118 NULL,
119 NULL, 119 NULL,
120 NULL)); 120 NULL));
121 121
122 EXPECT_EQ(command_buffer_object, plugin_object_->OpenCommandBuffer()); 122 EXPECT_EQ(command_buffer_object, plugin_object_->OpenCommandBuffer());
123 123
124 // Calling OpenCommandBuffer again just returns the existing command buffer. 124 // Calling OpenCommandBuffer again just returns the existing command buffer.
125 EXPECT_EQ(command_buffer_object, plugin_object_->OpenCommandBuffer()); 125 EXPECT_EQ(command_buffer_object, plugin_object_->OpenCommandBuffer());
126 126
127 EXPECT_EQ(NPERR_NO_ERROR, plugin_object_->Destroy(NULL)); 127 EXPECT_EQ(NPERR_NO_ERROR, plugin_object_->Destroy(NULL));
128 } 128 }
129 129
130 TEST_F(GPUPluginObjectTest, OpenCommandBufferReturnsNullIfCannotInitialize) { 130 TEST_F(GPUPluginObjectTest, OpenCommandBufferReturnsNullIfCannotInitialize) {
131 // Intercept creation of command buffer object and return mock. 131 // Intercept creation of command buffer object and return mock.
132 NPObjectPointer<MockCommandBuffer> command_buffer_object = 132 NPObjectPointer<MockCommandBuffer> command_buffer_object =
133 NPCreateObject<StrictMock<MockCommandBuffer> >(NULL); 133 NPCreateObject<StrictMock<MockCommandBuffer> >(NULL);
134 EXPECT_CALL(mock_browser_, CreateObject(NULL, 134 EXPECT_CALL(mock_browser_, CreateObject(NULL,
135 BaseNPObject::GetNPClass<CommandBuffer>())) 135 NPGetClass<CommandBuffer>()))
136 .WillOnce(Return(command_buffer_object.ToReturned())); 136 .WillOnce(Return(command_buffer_object.ToReturned()));
137 137
138 EXPECT_CALL(*command_buffer_object.Get(), Initialize(1024)) 138 EXPECT_CALL(*command_buffer_object.Get(), Initialize(1024))
139 .WillOnce(Return(false)); 139 .WillOnce(Return(false));
140 140
141 EXPECT_EQ(NPERR_NO_ERROR, plugin_object_->New("application/foo", 141 EXPECT_EQ(NPERR_NO_ERROR, plugin_object_->New("application/foo",
142 0, 142 0,
143 NULL, 143 NULL,
144 NULL, 144 NULL,
145 NULL)); 145 NULL));
146 146
147 EXPECT_EQ(NPObjectPointer<NPObject>(), plugin_object_->OpenCommandBuffer()); 147 EXPECT_EQ(NPObjectPointer<NPObject>(), plugin_object_->OpenCommandBuffer());
148 148
149 EXPECT_EQ(NPERR_NO_ERROR, plugin_object_->Destroy(NULL)); 149 EXPECT_EQ(NPERR_NO_ERROR, plugin_object_->Destroy(NULL));
150 } 150 }
151 } // namespace gpu_plugin 151 } // namespace gpu_plugin
152 } // namespace o3d 152 } // namespace o3d
OLDNEW
« no previous file with comments | « o3d/gpu_plugin/gpu_plugin_object_factory.cc ('k') | o3d/gpu_plugin/gpu_plugin_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698