Chromium Code Reviews| 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/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
| 6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.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_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
| 9 #include "chrome/browser/extensions/extension_function_test_utils.h" | 9 #include "chrome/browser/extensions/extension_function_test_utils.h" |
| 10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 static std::string GenerateCreateFunctionArgs(const std::string& protocol, | 26 static std::string GenerateCreateFunctionArgs(const std::string& protocol, |
| 27 const std::string& address, | 27 const std::string& address, |
| 28 int port) { | 28 int port) { |
| 29 return base::StringPrintf("[\"%s\", \"%s\", %d]", protocol.c_str(), | 29 return base::StringPrintf("[\"%s\", \"%s\", %d]", protocol.c_str(), |
| 30 address.c_str(), port); | 30 address.c_str(), port); |
| 31 } | 31 } |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 } // namespace | 34 } // namespace |
| 35 | 35 |
| 36 // TODO(penghuang): Re-enable socket api tests. | |
| 37 #if 0 | |
|
miket_OOO
2012/04/23 22:23:40
Can we do this before submitting? How do we know t
Peng
2012/04/24 15:07:14
The UDP part of apitest has to be re-implemented.
miket_OOO
2012/04/24 18:13:56
Thanks. There should be at least minimal end-to-en
Peng
2012/04/24 20:31:38
Done.
| |
| 36 IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketUDPCreateGood) { | 38 IN_PROC_BROWSER_TEST_F(SocketApiTest, SocketUDPCreateGood) { |
| 37 scoped_refptr<extensions::SocketCreateFunction> socket_create_function( | 39 scoped_refptr<extensions::SocketCreateFunction> socket_create_function( |
| 38 new extensions::SocketCreateFunction()); | 40 new extensions::SocketCreateFunction()); |
| 39 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); | 41 scoped_refptr<Extension> empty_extension(utils::CreateEmptyExtension()); |
| 40 | 42 |
| 41 socket_create_function->set_extension(empty_extension.get()); | 43 socket_create_function->set_extension(empty_extension.get()); |
| 42 socket_create_function->set_has_callback(true); | 44 socket_create_function->set_has_callback(true); |
| 43 | 45 |
| 44 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnResult( | 46 scoped_ptr<base::Value> result(utils::RunFunctionAndReturnResult( |
| 45 socket_create_function, | 47 socket_create_function, |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 | 129 |
| 128 ExtensionTestMessageListener listener("info_please", true); | 130 ExtensionTestMessageListener listener("info_please", true); |
| 129 | 131 |
| 130 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/api"))); | 132 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("socket/api"))); |
| 131 EXPECT_TRUE(listener.WaitUntilSatisfied()); | 133 EXPECT_TRUE(listener.WaitUntilSatisfied()); |
| 132 listener.Reply( | 134 listener.Reply( |
| 133 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port)); | 135 base::StringPrintf("tcp:%s:%d", host_port_pair.host().c_str(), port)); |
| 134 | 136 |
| 135 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 137 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 136 } | 138 } |
| 139 #endif | |
| OLD | NEW |