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

Side by Side Diff: chrome/browser/extensions/api/sockets_tcp/sockets_tcp_api_unittest.cc

Issue 177003015: Pull AsyncApiFunction out of src/chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase for storage_api Created 6 years, 9 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
OLDNEW
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/values.h" 5 #include "base/values.h"
6 #include "chrome/browser/browser_process_impl.h" 6 #include "chrome/browser/browser_process_impl.h"
7 #include "chrome/browser/extensions/api/api_function.h"
8 #include "chrome/browser/extensions/api/api_resource_manager.h" 7 #include "chrome/browser/extensions/api/api_resource_manager.h"
9 #include "chrome/browser/extensions/api/socket/socket.h" 8 #include "chrome/browser/extensions/api/socket/socket.h"
10 #include "chrome/browser/extensions/api/socket/tcp_socket.h" 9 #include "chrome/browser/extensions/api/socket/tcp_socket.h"
11 #include "chrome/browser/extensions/api/sockets_tcp/sockets_tcp_api.h" 10 #include "chrome/browser/extensions/api/sockets_tcp/sockets_tcp_api.h"
12 #include "chrome/browser/extensions/extension_api_unittest.h" 11 #include "chrome/browser/extensions/extension_api_unittest.h"
13 #include "chrome/browser/extensions/test_extension_system.h" 12 #include "chrome/browser/extensions/test_extension_system.h"
14 #include "chrome/browser/profiles/profile_manager.h" 13 #include "chrome/browser/profiles/profile_manager.h"
15 #include "chrome/test/base/testing_browser_process.h" 14 #include "chrome/test/base/testing_browser_process.h"
16 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
17 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
18 17
19 namespace extensions { 18 namespace extensions {
20 namespace api { 19 namespace api {
21 20
22 static 21 static BrowserContextKeyedService* ApiResourceManagerTestFactory(
23 BrowserContextKeyedService* ApiResourceManagerTestFactory( 22 content::BrowserContext* context) {
24 content::BrowserContext* profile) {
25 content::BrowserThread::ID id; 23 content::BrowserThread::ID id;
26 CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id)); 24 CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id));
27 return ApiResourceManager<ResumableTCPSocket>:: 25 return ApiResourceManager<
28 CreateApiResourceManagerForTest(static_cast<Profile*>(profile), id); 26 ResumableTCPSocket>::CreateApiResourceManagerForTest(context, id);
29 } 27 }
30 28
31 class SocketsTcpUnitTest : public ExtensionApiUnittest { 29 class SocketsTcpUnitTest : public ExtensionApiUnittest {
32 public: 30 public:
33 virtual void SetUp() { 31 virtual void SetUp() {
34 ExtensionApiUnittest::SetUp(); 32 ExtensionApiUnittest::SetUp();
35 33
36 ApiResourceManager<ResumableTCPSocket>::GetFactoryInstance()-> 34 ApiResourceManager<ResumableTCPSocket>::GetFactoryInstance()->
37 SetTestingFactoryAndUse(browser()->profile(), 35 SetTestingFactoryAndUse(browser()->profile(),
38 ApiResourceManagerTestFactory); 36 ApiResourceManagerTestFactory);
(...skipping 10 matching lines...) Expand all
49 function->set_work_thread_id(id); 47 function->set_work_thread_id(id);
50 48
51 // Run tests 49 // Run tests
52 scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary( 50 scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
53 function, "[{\"persistent\": true, \"name\": \"foo\"}]")); 51 function, "[{\"persistent\": true, \"name\": \"foo\"}]"));
54 ASSERT_TRUE(result.get()); 52 ASSERT_TRUE(result.get());
55 } 53 }
56 54
57 } // namespace api 55 } // namespace api
58 } // namespace extensions 56 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698