OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2013 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 "ppapi/c/ppb_core.h" | |
6 #include "ppapi/proxy/interface_list.h" | |
7 #include "ppapi/proxy/ppapi_proxy_test.h" | |
8 | |
9 namespace ppapi { | |
10 namespace proxy { | |
11 | |
12 class InterfaceListTest : public PluginProxyTest { | |
13 public: | |
14 // Wrapper function so we can use the private InterfaceList::AddPPB. | |
15 void AddPPB(InterfaceList* list, | |
16 const char* iface_name, void* iface_addr, Permission perm) { | |
17 list->AddPPB(iface_name, iface_addr, perm); | |
18 } | |
19 }; | |
20 | |
21 // Tests looking up a stable interface. | |
22 TEST_F(InterfaceListTest, Stable) { | |
23 InterfaceList list; | |
24 ASSERT_TRUE(list.GetInterfaceForPPB(PPB_CORE_INTERFACE_1_0) != NULL); | |
25 ASSERT_TRUE(list.GetInterfaceForPPB("FakeUnknownInterface") == NULL); | |
26 } | |
27 | |
28 // Tests that dev channel restrictions work properly. | |
29 TEST_F(InterfaceListTest, DevChannel) { | |
30 InterfaceList list; | |
31 static const char* iface_name = "TestDevChannelInterface"; | |
32 void* iface_addr = (void*)0xdeadbeef; | |
33 AddPPB(&list, iface_name, iface_addr, PERMISSION_DEV_CHANNEL); | |
34 InterfaceList::SetProcessGlobalPermissions( | |
35 PpapiPermissions(PERMISSION_NONE)); | |
dmichael (off chromium)
2013/12/18 22:40:50
Might be good to make sure PERMISSION_DEV doesn't
| |
36 ASSERT_TRUE(list.GetInterfaceForPPB(iface_name) == NULL); | |
37 InterfaceList::SetProcessGlobalPermissions( | |
38 PpapiPermissions(PERMISSION_DEV_CHANNEL)); | |
39 ASSERT_TRUE(list.GetInterfaceForPPB(iface_name) == iface_addr); | |
40 } | |
41 | |
42 } // namespace proxy | |
43 } // namespace ppapi | |
OLD | NEW |