| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/browser_process_impl.h" | 9 #include "chrome/browser/browser_process_impl.h" |
| 10 #include "chrome/browser/extensions/extension_api_unittest.h" | 10 #include "chrome/browser/extensions/extension_api_unittest.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 // Create SocketCreateFunction and put it on BrowserThread | 42 // Create SocketCreateFunction and put it on BrowserThread |
| 43 SocketCreateFunction* function = new SocketCreateFunction(); | 43 SocketCreateFunction* function = new SocketCreateFunction(); |
| 44 function->set_work_thread_id(id); | 44 function->set_work_thread_id(id); |
| 45 | 45 |
| 46 // Run tests | 46 // Run tests |
| 47 std::unique_ptr<base::DictionaryValue> result( | 47 std::unique_ptr<base::DictionaryValue> result( |
| 48 RunFunctionAndReturnDictionary(function, "[\"tcp\"]")); | 48 RunFunctionAndReturnDictionary(function, "[\"tcp\"]")); |
| 49 ASSERT_TRUE(result.get()); | 49 ASSERT_TRUE(result.get()); |
| 50 } | 50 } |
| 51 | 51 |
| 52 TEST_F(SocketUnitTest, InvalidPort) { |
| 53 const std::string kError = "Port must be a value between 0 and 65535."; |
| 54 |
| 55 SocketConnectFunction* connect_function = new SocketConnectFunction(); |
| 56 EXPECT_EQ(kError, |
| 57 RunFunctionAndReturnError(connect_function, "[1, \"foo\", -1]")); |
| 58 SocketBindFunction* bind_function = new SocketBindFunction(); |
| 59 EXPECT_EQ(kError, |
| 60 RunFunctionAndReturnError(bind_function, "[1, \"foo\", -1]")); |
| 61 } |
| 62 |
| 52 } // namespace extensions | 63 } // namespace extensions |
| OLD | NEW |