| Index: ppapi/proxy/interface_list_unittest.cc
|
| diff --git a/ppapi/proxy/interface_list_unittest.cc b/ppapi/proxy/interface_list_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..fa332fd040b33a0c0597fe760b99786ae33a38f4
|
| --- /dev/null
|
| +++ b/ppapi/proxy/interface_list_unittest.cc
|
| @@ -0,0 +1,42 @@
|
| +// Copyright (c) 2013 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "ppapi/c/ppb_core.h"
|
| +#include "ppapi/proxy/interface_list.h"
|
| +#include "ppapi/proxy/ppapi_proxy_test.h"
|
| +
|
| +namespace ppapi {
|
| +namespace proxy {
|
| +
|
| +class InterfaceListTest : public PluginProxyTest {
|
| + public:
|
| + // Wrapper function so we can use the private InterfaceList::AddPPB.
|
| + void AddPPB(InterfaceList* list,
|
| + const char* iface_name, void* iface_addr, Permission perm,
|
| + bool requires_dev_channel) {
|
| + list->AddPPB(iface_name, iface_addr, perm, requires_dev_channel);
|
| + }
|
| +};
|
| +
|
| +// Tests looking up a stable interface.
|
| +TEST_F(InterfaceListTest, Stable) {
|
| + InterfaceList list;
|
| + ASSERT_TRUE(list.GetInterfaceForPPB(PPB_CORE_INTERFACE_1_0) != NULL);
|
| + ASSERT_TRUE(list.GetInterfaceForPPB("FakeUnknownInterface") == NULL);
|
| +}
|
| +
|
| +// Tests that dev channel restrictions work properly.
|
| +TEST_F(InterfaceListTest, DevChannel) {
|
| + InterfaceList list;
|
| + static const char* iface_name = "TestDevChannelInterface";
|
| + void* iface_addr = (void*)0xdeadbeef;
|
| + AddPPB(&list, iface_name, iface_addr, PERMISSION_NONE, true);
|
| + InterfaceList::SetSupportsDevChannel(false);
|
| + ASSERT_TRUE(list.GetInterfaceForPPB(iface_name) == NULL);
|
| + InterfaceList::SetSupportsDevChannel(true);
|
| + ASSERT_TRUE(list.GetInterfaceForPPB(iface_name) == iface_addr);
|
| +}
|
| +
|
| +} // namespace proxy
|
| +} // namespace ppapi
|
|
|