| 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 "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/socket/socket_api.h" | 7 #include "chrome/browser/extensions/api/socket/socket_api.h" |
| 8 #include "chrome/browser/extensions/extension_function_test_utils.h" | 8 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 9 #include "chrome/browser/extensions/test_extension_system.h" | 9 #include "chrome/browser/extensions/test_extension_system.h" |
| 10 #include "chrome/browser/profiles/profile_manager.h" | 10 #include "chrome/browser/profiles/profile_manager.h" |
| 11 #include "chrome/test/base/browser_with_test_window_test.h" | 11 #include "chrome/test/base/browser_with_test_window_test.h" |
| 12 #include "chrome/test/base/testing_browser_process.h" | 12 #include "chrome/test/base/testing_browser_process.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 utils = extension_function_test_utils; | 16 namespace utils = extension_function_test_utils; |
| 17 | 17 |
| 18 namespace extensions { | 18 namespace extensions { |
| 19 | 19 |
| 20 class SocketUnitTest : public BrowserWithTestWindowTest { | 20 class SocketUnitTest : public BrowserWithTestWindowTest { |
| 21 public: | 21 public: |
| 22 virtual void SetUp() { | 22 virtual void SetUp() { |
| 23 BrowserWithTestWindowTest::SetUp(); | 23 BrowserWithTestWindowTest::SetUp(); |
| 24 | 24 |
| 25 TestExtensionSystem* system = static_cast<TestExtensionSystem*>( | 25 TestExtensionSystem* system = static_cast<TestExtensionSystem*>( |
| 26 ExtensionSystem::Get(browser()->profile())); | 26 ExtensionSystem::Get(browser()->profile())); |
| 27 system->CreateSocketManager(); | 27 system->CreateSocketManager(); |
| 28 | 28 |
| 29 extension_ = utils::CreateEmptyExtensionWithLocation( | 29 extension_ = utils::CreateEmptyExtensionWithLocation( |
| 30 extensions::Extension::LOAD); | 30 extensions::Manifest::LOAD); |
| 31 } | 31 } |
| 32 | 32 |
| 33 base::Value* RunFunctionWithExtension( | 33 base::Value* RunFunctionWithExtension( |
| 34 UIThreadExtensionFunction* function, const std::string& args) { | 34 UIThreadExtensionFunction* function, const std::string& args) { |
| 35 scoped_refptr<UIThreadExtensionFunction> delete_function(function); | 35 scoped_refptr<UIThreadExtensionFunction> delete_function(function); |
| 36 function->set_extension(extension_.get()); | 36 function->set_extension(extension_.get()); |
| 37 return utils::RunFunctionAndReturnSingleResult(function, args, browser()); | 37 return utils::RunFunctionAndReturnSingleResult(function, args, browser()); |
| 38 } | 38 } |
| 39 | 39 |
| 40 base::DictionaryValue* RunFunctionAndReturnDict( | 40 base::DictionaryValue* RunFunctionAndReturnDict( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 53 // this CL landed was hard enough already, so we're going to save this work | 53 // this CL landed was hard enough already, so we're going to save this work |
| 54 // for another day. | 54 // for another day. |
| 55 if (false) { | 55 if (false) { |
| 56 scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDict( | 56 scoped_ptr<base::DictionaryValue> result(RunFunctionAndReturnDict( |
| 57 new SocketCreateFunction(), "[\"tcp\"]")); | 57 new SocketCreateFunction(), "[\"tcp\"]")); |
| 58 ASSERT_TRUE(result.get()); | 58 ASSERT_TRUE(result.get()); |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 } // namespace extensions | 62 } // namespace extensions |
| OLD | NEW |