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

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

Issue 141523010: Pepper: Log in UMA when an interface is used. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Testing and comments. Created 6 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
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | ppapi/proxy/ppapi_messages.h » ('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) 2013 The Chromium Authors. All rights reserved. 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 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 "base/hash.h"
5 #include "ppapi/c/ppb_core.h" 6 #include "ppapi/c/ppb_core.h"
6 #include "ppapi/proxy/interface_list.h" 7 #include "ppapi/proxy/interface_list.h"
7 #include "ppapi/proxy/ppapi_proxy_test.h" 8 #include "ppapi/proxy/ppapi_proxy_test.h"
8 9
9 namespace ppapi { 10 namespace ppapi {
10 namespace proxy { 11 namespace proxy {
11 12
12 class InterfaceListTest : public PluginProxyTest { 13 class InterfaceListTest : public PluginProxyTest {
13 public: 14 public:
14 // Wrapper function so we can use the private InterfaceList::AddPPB. 15 // Wrapper function so we can use the private InterfaceList::AddPPB.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 ASSERT_TRUE(list.GetInterfaceForPPB(dev_channel_iface_name) == NULL); 56 ASSERT_TRUE(list.GetInterfaceForPPB(dev_channel_iface_name) == NULL);
56 ASSERT_TRUE(list.GetInterfaceForPPB(dev_iface_name) == dev_iface_addr); 57 ASSERT_TRUE(list.GetInterfaceForPPB(dev_iface_name) == dev_iface_addr);
57 58
58 InterfaceList::SetProcessGlobalPermissions( 59 InterfaceList::SetProcessGlobalPermissions(
59 PpapiPermissions(PERMISSION_DEV | PERMISSION_DEV_CHANNEL)); 60 PpapiPermissions(PERMISSION_DEV | PERMISSION_DEV_CHANNEL));
60 ASSERT_TRUE(list.GetInterfaceForPPB(dev_channel_iface_name) == 61 ASSERT_TRUE(list.GetInterfaceForPPB(dev_channel_iface_name) ==
61 dev_channel_iface_addr); 62 dev_channel_iface_addr);
62 ASSERT_TRUE(list.GetInterfaceForPPB(dev_iface_name) == dev_iface_addr); 63 ASSERT_TRUE(list.GetInterfaceForPPB(dev_iface_name) == dev_iface_addr);
63 } 64 }
64 65
66 // Test that the hash function provided by base::Hash is unchanged. This is so
67 // that we will generate correct values when logging interface use to UMA.
68 TEST_F(InterfaceListTest, InterfaceHash) {
69 std::string name = "PPB_InputEvent;1.0";
70 uint32 data = base::Hash(name.c_str(), name.size());
71 int hash = static_cast<int>(data & 0x7fffffff);
Alexei Svitkine (slow) 2014/02/04 18:53:31 Can you make a function in InterfaceList to comput
72 EXPECT_EQ(612625164, hash);
73
74 name = "PPB_TCPSocket;1.1";
75 data = base::Hash(name.c_str(), name.size());
76 hash = static_cast<int>(data & 0x7fffffff);
77 EXPECT_EQ(79708274, hash);
78 }
79
65 } // namespace proxy 80 } // namespace proxy
66 } // namespace ppapi 81 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/interface_list.cc ('k') | ppapi/proxy/ppapi_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698