OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <memory> | 5 #include <memory> |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/browser_process_impl.h" | 9 #include "chrome/browser/browser_process_impl.h" |
10 #include "chrome/browser/extensions/extension_api_unittest.h" | 10 #include "chrome/browser/extensions/extension_api_unittest.h" |
11 #include "chrome/browser/extensions/test_extension_system.h" | 11 #include "chrome/browser/extensions/test_extension_system.h" |
12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
13 #include "chrome/test/base/testing_browser_process.h" | 13 #include "chrome/test/base/testing_browser_process.h" |
14 #include "extensions/browser/api/api_resource_manager.h" | 14 #include "extensions/browser/api/api_resource_manager.h" |
15 #include "extensions/browser/api/socket/socket.h" | 15 #include "extensions/browser/api/socket/socket.h" |
16 #include "extensions/browser/api/socket/socket_api.h" | 16 #include "extensions/browser/api/socket/socket_api.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 namespace extensions { | 20 namespace extensions { |
21 | 21 |
22 std::unique_ptr<KeyedService> ApiResourceManagerTestFactory( | 22 std::unique_ptr<KeyedService> ApiResourceManagerTestFactory( |
23 content::BrowserContext* context) { | 23 content::BrowserContext* context) { |
24 return base::WrapUnique(new ApiResourceManager<Socket>(context)); | 24 return base::MakeUnique<ApiResourceManager<Socket>>(context); |
25 } | 25 } |
26 | 26 |
27 class SocketUnitTest : public ExtensionApiUnittest { | 27 class SocketUnitTest : public ExtensionApiUnittest { |
28 public: | 28 public: |
29 void SetUp() override { | 29 void SetUp() override { |
30 ExtensionApiUnittest::SetUp(); | 30 ExtensionApiUnittest::SetUp(); |
31 | 31 |
32 ApiResourceManager<Socket>::GetFactoryInstance()->SetTestingFactoryAndUse( | 32 ApiResourceManager<Socket>::GetFactoryInstance()->SetTestingFactoryAndUse( |
33 browser()->profile(), ApiResourceManagerTestFactory); | 33 browser()->profile(), ApiResourceManagerTestFactory); |
34 } | 34 } |
(...skipping 19 matching lines...) Expand all Loading... |
54 | 54 |
55 SocketConnectFunction* connect_function = new SocketConnectFunction(); | 55 SocketConnectFunction* connect_function = new SocketConnectFunction(); |
56 EXPECT_EQ(kError, | 56 EXPECT_EQ(kError, |
57 RunFunctionAndReturnError(connect_function, "[1, \"foo\", -1]")); | 57 RunFunctionAndReturnError(connect_function, "[1, \"foo\", -1]")); |
58 SocketBindFunction* bind_function = new SocketBindFunction(); | 58 SocketBindFunction* bind_function = new SocketBindFunction(); |
59 EXPECT_EQ(kError, | 59 EXPECT_EQ(kError, |
60 RunFunctionAndReturnError(bind_function, "[1, \"foo\", -1]")); | 60 RunFunctionAndReturnError(bind_function, "[1, \"foo\", -1]")); |
61 } | 61 } |
62 | 62 |
63 } // namespace extensions | 63 } // namespace extensions |
OLD | NEW |