| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "extensions/browser/api/sockets_udp/sockets_udp_api.h" | 5 #include "extensions/browser/api/sockets_udp/sockets_udp_api.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| 11 #include "extensions/browser/api/api_resource_manager.h" | 11 #include "extensions/browser/api/api_resource_manager.h" |
| 12 #include "extensions/browser/api/socket/socket.h" | 12 #include "extensions/browser/api/socket/socket.h" |
| 13 #include "extensions/browser/api/socket/udp_socket.h" | 13 #include "extensions/browser/api/socket/udp_socket.h" |
| 14 #include "extensions/browser/api_unittest.h" | 14 #include "extensions/browser/api_unittest.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 namespace api { | 19 namespace api { |
| 20 | 20 |
| 21 static std::unique_ptr<KeyedService> ApiResourceManagerTestFactory( | 21 static std::unique_ptr<KeyedService> ApiResourceManagerTestFactory( |
| 22 content::BrowserContext* context) { | 22 content::BrowserContext* context) { |
| 23 return base::WrapUnique(new ApiResourceManager<ResumableUDPSocket>(context)); | 23 return base::MakeUnique<ApiResourceManager<ResumableUDPSocket>>(context); |
| 24 } | 24 } |
| 25 | 25 |
| 26 class SocketsUdpUnitTest : public ApiUnitTest { | 26 class SocketsUdpUnitTest : public ApiUnitTest { |
| 27 public: | 27 public: |
| 28 void SetUp() override { | 28 void SetUp() override { |
| 29 ApiUnitTest::SetUp(); | 29 ApiUnitTest::SetUp(); |
| 30 | 30 |
| 31 ApiResourceManager<ResumableUDPSocket>::GetFactoryInstance() | 31 ApiResourceManager<ResumableUDPSocket>::GetFactoryInstance() |
| 32 ->SetTestingFactoryAndUse(browser_context(), | 32 ->SetTestingFactoryAndUse(browser_context(), |
| 33 ApiResourceManagerTestFactory); | 33 ApiResourceManagerTestFactory); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 44 function->set_work_thread_id(id); | 44 function->set_work_thread_id(id); |
| 45 | 45 |
| 46 // Run tests | 46 // Run tests |
| 47 std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary( | 47 std::unique_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary( |
| 48 function, "[{\"persistent\": true, \"name\": \"foo\"}]")); | 48 function, "[{\"persistent\": true, \"name\": \"foo\"}]")); |
| 49 ASSERT_TRUE(result.get()); | 49 ASSERT_TRUE(result.get()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 } // namespace api | 52 } // namespace api |
| 53 } // namespace extensions | 53 } // namespace extensions |
| OLD | NEW |