Chromium Code Reviews| Index: ppapi/proxy/interface_list_unittest.cc |
| diff --git a/ppapi/proxy/interface_list_unittest.cc b/ppapi/proxy/interface_list_unittest.cc |
| index 17140f06b07fef5260281184897865468e5e5aa0..30557653848edb21fb1edb14efcba561d592e7ed 100644 |
| --- a/ppapi/proxy/interface_list_unittest.cc |
| +++ b/ppapi/proxy/interface_list_unittest.cc |
| @@ -2,6 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +#include "base/hash.h" |
| #include "ppapi/c/ppb_core.h" |
| #include "ppapi/proxy/interface_list.h" |
| #include "ppapi/proxy/ppapi_proxy_test.h" |
| @@ -62,5 +63,19 @@ TEST_F(InterfaceListTest, DevChannel) { |
| ASSERT_TRUE(list.GetInterfaceForPPB(dev_iface_name) == dev_iface_addr); |
| } |
| +// Test that the hash function provided by base::Hash is unchanged. This is so |
| +// that we will generate correct values when logging interface use to UMA. |
| +TEST_F(InterfaceListTest, InterfaceHash) { |
| + std::string name = "PPB_InputEvent;1.0"; |
| + uint32 data = base::Hash(name.c_str(), name.size()); |
| + 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
|
| + EXPECT_EQ(612625164, hash); |
| + |
| + name = "PPB_TCPSocket;1.1"; |
| + data = base::Hash(name.c_str(), name.size()); |
| + hash = static_cast<int>(data & 0x7fffffff); |
| + EXPECT_EQ(79708274, hash); |
| +} |
| + |
| } // namespace proxy |
| } // namespace ppapi |