OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 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 "extensions/browser/api/dns/host_resolver_wrapper.h" |
| 6 #include "extensions/browser/api/dns/mock_host_resolver_creator.h" |
| 7 #include "extensions/browser/api/sockets_udp/sockets_udp_api.h" |
| 8 #include "extensions/browser/api_test_utils.h" |
| 9 #include "extensions/common/extension.h" |
| 10 #include "extensions/common/test_util.h" |
| 11 #include "extensions/shell/test/shell_test.h" |
| 12 |
| 13 using extensions::api_test_utils::RunFunctionAndReturnSingleResult; |
| 14 |
| 15 namespace extensions { |
| 16 |
| 17 class SocketsUdpApiTest : public AppShellTest {}; |
| 18 |
| 19 IN_PROC_BROWSER_TEST_F(SocketsUdpApiTest, SocketsUdpCreateGood) { |
| 20 scoped_refptr<extensions::core_api::SocketsUdpCreateFunction> |
| 21 socket_create_function( |
| 22 new extensions::core_api::SocketsUdpCreateFunction()); |
| 23 scoped_refptr<Extension> empty_extension = test_util::CreateEmptyExtension(); |
| 24 |
| 25 socket_create_function->set_extension(empty_extension.get()); |
| 26 socket_create_function->set_has_callback(true); |
| 27 |
| 28 scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult( |
| 29 socket_create_function.get(), "[]", browser_context())); |
| 30 |
| 31 base::DictionaryValue* value = NULL; |
| 32 ASSERT_TRUE(result->GetAsDictionary(&value)); |
| 33 int socketId = -1; |
| 34 EXPECT_TRUE(value->GetInteger("socketId", &socketId)); |
| 35 ASSERT_TRUE(socketId > 0); |
| 36 } |
| 37 |
| 38 } // namespace extensions |
OLD | NEW |