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

Side by Side Diff: content/browser/renderer_host/pepper/pepper_gamepad_host_unittest.cc

Issue 2082343002: Remove calls to deprecated MessageLoop methods in content. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Created 4 years, 5 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 "content/browser/renderer_host/pepper/pepper_gamepad_host.h" 5 #include "content/browser/renderer_host/pepper/pepper_gamepad_host.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <string.h> 8 #include <string.h>
9 9
10 #include <memory> 10 #include <memory>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/run_loop.h"
14 #include "build/build_config.h" 15 #include "build/build_config.h"
15 #include "content/browser/gamepad/gamepad_test_helpers.h" 16 #include "content/browser/gamepad/gamepad_test_helpers.h"
16 #include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h" 17 #include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h"
17 #include "content/common/gamepad_hardware_buffer.h" 18 #include "content/common/gamepad_hardware_buffer.h"
18 #include "ppapi/c/pp_errors.h" 19 #include "ppapi/c/pp_errors.h"
19 #include "ppapi/host/host_message_context.h" 20 #include "ppapi/host/host_message_context.h"
20 #include "ppapi/proxy/gamepad_resource.h" 21 #include "ppapi/proxy/gamepad_resource.h"
21 #include "ppapi/proxy/ppapi_messages.h" 22 #include "ppapi/proxy/ppapi_messages.h"
22 #include "ppapi/proxy/resource_message_params.h" 23 #include "ppapi/proxy/resource_message_params.h"
23 #include "ppapi/shared_impl/ppb_gamepad_shared.h" 24 #include "ppapi/shared_impl/ppb_gamepad_shared.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ppapi::host::HostMessageContext context( 149 ppapi::host::HostMessageContext context(
149 ppapi::proxy::ResourceMessageCallParams(pp_resource, 1)); 150 ppapi::proxy::ResourceMessageCallParams(pp_resource, 1));
150 EXPECT_EQ(PP_OK_COMPLETIONPENDING, 151 EXPECT_EQ(PP_OK_COMPLETIONPENDING,
151 gamepad_host.OnResourceMessageReceived( 152 gamepad_host.OnResourceMessageReceived(
152 PpapiHostMsg_Gamepad_RequestMemory(), &context)); 153 PpapiHostMsg_Gamepad_RequestMemory(), &context));
153 154
154 MockGamepadDataFetcher* fetcher = service_->data_fetcher(); 155 MockGamepadDataFetcher* fetcher = service_->data_fetcher();
155 fetcher->WaitForDataReadAndCallbacksIssued(); 156 fetcher->WaitForDataReadAndCallbacksIssued();
156 157
157 // It should not have sent the callback message. 158 // It should not have sent the callback message.
158 service_->message_loop().RunUntilIdle(); 159 base::RunLoop().RunUntilIdle();
159 EXPECT_EQ(0u, sink().message_count()); 160 EXPECT_EQ(0u, sink().message_count());
160 161
161 // Set a button down and wait for it to be read twice. 162 // Set a button down and wait for it to be read twice.
162 blink::WebGamepads button_down_data = default_data; 163 blink::WebGamepads button_down_data = default_data;
163 button_down_data.items[0].buttons[0].value = 1.f; 164 button_down_data.items[0].buttons[0].value = 1.f;
164 button_down_data.items[0].buttons[0].pressed = true; 165 button_down_data.items[0].buttons[0].pressed = true;
165 fetcher->SetTestData(button_down_data); 166 fetcher->SetTestData(button_down_data);
166 fetcher->WaitForDataReadAndCallbacksIssued(); 167 fetcher->WaitForDataReadAndCallbacksIssued();
167 168
168 // It should have sent a callback. 169 // It should have sent a callback.
169 service_->message_loop().RunUntilIdle(); 170 base::RunLoop().RunUntilIdle();
170 ppapi::proxy::ResourceMessageReplyParams reply_params; 171 ppapi::proxy::ResourceMessageReplyParams reply_params;
171 IPC::Message reply_msg; 172 IPC::Message reply_msg;
172 ASSERT_TRUE(sink().GetFirstResourceReplyMatching( 173 ASSERT_TRUE(sink().GetFirstResourceReplyMatching(
173 PpapiPluginMsg_Gamepad_SendMemory::ID, &reply_params, &reply_msg)); 174 PpapiPluginMsg_Gamepad_SendMemory::ID, &reply_params, &reply_msg));
174 175
175 // Extract the shared memory handle. 176 // Extract the shared memory handle.
176 base::SharedMemoryHandle reply_handle; 177 base::SharedMemoryHandle reply_handle;
177 EXPECT_TRUE(reply_params.TakeSharedMemoryHandleAtIndex(0, &reply_handle)); 178 EXPECT_TRUE(reply_params.TakeSharedMemoryHandleAtIndex(0, &reply_handle));
178 179
179 // Validate the shared memory. 180 // Validate the shared memory.
(...skipping 12 matching lines...) Expand all
192 buffer->buffer.items[0].buttons[i].pressed); 193 buffer->buffer.items[0].buttons[i].pressed);
193 } 194 }
194 195
195 // Duplicate requests should be denied. 196 // Duplicate requests should be denied.
196 EXPECT_EQ(PP_ERROR_FAILED, 197 EXPECT_EQ(PP_ERROR_FAILED,
197 gamepad_host.OnResourceMessageReceived( 198 gamepad_host.OnResourceMessageReceived(
198 PpapiHostMsg_Gamepad_RequestMemory(), &context)); 199 PpapiHostMsg_Gamepad_RequestMemory(), &context));
199 } 200 }
200 201
201 } // namespace content 202 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698