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

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

Issue 461273003: Rework ExtensionApiUnittest to run in extensions_unittests, removing its Chrome dependencies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: content_plugin Created 6 years, 3 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "base/values.h"
6 #include "chrome/browser/browser_process_impl.h"
7 #include "chrome/browser/extensions/extension_api_unittest.h"
8 #include "chrome/browser/extensions/test_extension_system.h"
9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/test/base/testing_browser_process.h"
11 #include "extensions/browser/api/api_resource_manager.h"
12 #include "extensions/browser/api/socket/socket.h"
13 #include "extensions/browser/api/socket/tcp_socket.h"
14 #include "extensions/browser/api/sockets_tcp/sockets_tcp_api.h"
15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17
18 namespace extensions {
19 namespace core_api {
20
21 static KeyedService* ApiResourceManagerTestFactory(
22 content::BrowserContext* context) {
23 content::BrowserThread::ID id;
24 CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id));
25 return ApiResourceManager<
26 ResumableTCPSocket>::CreateApiResourceManagerForTest(context, id);
27 }
28
29 class SocketsTcpUnitTest : public ExtensionApiUnittest {
30 public:
31 virtual void SetUp() {
32 ExtensionApiUnittest::SetUp();
33
34 ApiResourceManager<ResumableTCPSocket>::GetFactoryInstance()
35 ->SetTestingFactoryAndUse(browser()->profile(),
36 ApiResourceManagerTestFactory);
37 }
38 };
39
40 TEST_F(SocketsTcpUnitTest, Create) {
41 // Get BrowserThread
42 content::BrowserThread::ID id;
43 CHECK(content::BrowserThread::GetCurrentThreadIdentifier(&id));
44
45 // Create SocketCreateFunction and put it on BrowserThread
46 SocketsTcpCreateFunction* function = new SocketsTcpCreateFunction();
47 function->set_work_thread_id(id);
48
49 // Run tests
50 scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDictionary(
51 function, "[{\"persistent\": true, \"name\": \"foo\"}]"));
52 ASSERT_TRUE(result.get());
53 }
54
55 } // namespace core_api
56 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_api_unittest.h » ('j') | content/content_tests.gypi » ('J')

Powered by Google App Engine
This is Rietveld 408576698