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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/values.h" | 6 #include "base/values.h" |
7 #include "content/public/test/test_browser_context.h" | 7 #include "content/public/test/test_browser_context.h" |
8 #include "extensions/browser/api/api_resource_manager.h" | 8 #include "extensions/browser/api/api_resource_manager.h" |
9 #include "extensions/browser/api/socket/socket.h" | 9 #include "extensions/browser/api/socket/socket.h" |
10 #include "extensions/browser/api/socket/tcp_socket.h" | 10 #include "extensions/browser/api/socket/tcp_socket.h" |
11 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h" | 11 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h" |
12 #include "extensions/browser/api_unittest.h" | 12 #include "extensions/browser/api_unittest.h" |
13 #include "testing/gmock/include/gmock/gmock.h" | 13 #include "testing/gmock/include/gmock/gmock.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
15 | 15 |
16 namespace extensions { | 16 namespace extensions { |
17 namespace core_api { | 17 namespace api { |
18 | 18 |
19 static scoped_ptr<KeyedService> ApiResourceManagerTestFactory( | 19 static scoped_ptr<KeyedService> ApiResourceManagerTestFactory( |
20 content::BrowserContext* context) { | 20 content::BrowserContext* context) { |
21 content::BrowserThread::ID id; | 21 content::BrowserThread::ID id; |
22 CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id)); | 22 CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id)); |
23 return ApiResourceManager< | 23 return ApiResourceManager< |
24 ResumableTCPSocket>::CreateApiResourceManagerForTest(context, id); | 24 ResumableTCPSocket>::CreateApiResourceManagerForTest(context, id); |
25 } | 25 } |
26 | 26 |
27 class SocketsTcpUnitTest : public ApiUnitTest { | 27 class SocketsTcpUnitTest : public ApiUnitTest { |
(...skipping 15 matching lines...) Expand all Loading... |
43 // Create SocketCreateFunction and put it on BrowserThread | 43 // Create SocketCreateFunction and put it on BrowserThread |
44 SocketsTcpCreateFunction* function = new SocketsTcpCreateFunction(); | 44 SocketsTcpCreateFunction* function = new SocketsTcpCreateFunction(); |
45 function->set_work_thread_id(id); | 45 function->set_work_thread_id(id); |
46 | 46 |
47 // Run tests | 47 // Run tests |
48 scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary( | 48 scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary( |
49 function, "[{\"persistent\": true, \"name\": \"foo\"}]")); | 49 function, "[{\"persistent\": true, \"name\": \"foo\"}]")); |
50 ASSERT_TRUE(result.get()); | 50 ASSERT_TRUE(result.get()); |
51 } | 51 } |
52 | 52 |
53 } // namespace core_api | 53 } // namespace api |
54 } // namespace extensions | 54 } // namespace extensions |
OLD | NEW |