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

Side by Side Diff: ppapi/proxy/host_dispatcher_unittest.cc

Issue 6286070: Remove all uses of the global Dispatcher Get function. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 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
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/scoped_ptr.h"
6 #include "ipc/ipc_message_utils.h"
7 #include "ppapi/c/ppb_audio.h"
8 #include "ppapi/c/ppp_instance.h"
9 #include "ppapi/proxy/ppapi_messages.h"
10 #include "ppapi/proxy/ppapi_proxy_test.h"
11
12 namespace pp {
13 namespace proxy {
14
15 namespace {
16
17 bool received_create = false;
18
19 // Implement PPB_Audio since it's a relatively simple PPB interface and
20 // includes bidirectional communication.
21 PP_Resource Create(PP_Instance instance, PP_Resource config,
22 PPB_Audio_Callback audio_callback, void* user_data) {
23 received_create = true;
24 return 0;
25 }
26 PP_Bool IsAudio(PP_Resource resource) {
27 return PP_FALSE;
28 }
29 PP_Resource GetCurrentConfig(PP_Resource audio) {
30 return 0;
31 }
32 PP_Bool StartPlayback(PP_Resource audio) {
33 return PP_FALSE;
34 }
35 PP_Bool StopPlayback(PP_Resource audio) {
36 return PP_FALSE;
37 }
38
39 PPB_Audio dummy_audio_interface = {
40 &Create,
41 &IsAudio,
42 &GetCurrentConfig,
43 &StartPlayback,
44 &StopPlayback
45 };
46
47 } // namespace
48
49 class HostDispatcherTest : public HostProxyTest {
50 public:
51 HostDispatcherTest() {}
52
53 bool HasTargetProxy(InterfaceID id) {
54 return !!plugin_dispatcher()->target_proxies_[id].get();
55 }
56 };
57
58 TEST_F(HostDispatcherTest, PPBCreation) {
59 // Sending a PPB message out of the blue should create a target proxy for
60 // that interface in the plugin.
61 EXPECT_FALSE(HasTargetProxy(INTERFACE_ID_PPB_AUDIO));
62 PpapiMsg_PPBAudio_NotifyAudioStreamCreated audio_msg(
63 INTERFACE_ID_PPB_AUDIO, HostResource(), 0,
64 IPC::PlatformFileForTransit(), base::SharedMemoryHandle(), 0);
65 host_dispatcher()->OnMessageReceived(audio_msg);
66 EXPECT_TRUE(HasTargetProxy(INTERFACE_ID_PPB_AUDIO));
67 }
68
69 } // namespace proxy
70 } // namespace pp
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698