Add testing/scripts/OWNERS
[chromium-blink-merge.git] / extensions / browser / api / sockets_udp / sockets_udp_apitest.cc
blob64736bbb12dfbbd64582b16f708b6c889a1f8f2c
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.
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"
13 using extensions::api_test_utils::RunFunctionAndReturnSingleResult;
15 namespace extensions {
17 class SocketsUdpApiTest : public AppShellTest {};
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();
25 socket_create_function->set_extension(empty_extension.get());
26 socket_create_function->set_has_callback(true);
28 scoped_ptr<base::Value> result(RunFunctionAndReturnSingleResult(
29 socket_create_function.get(), "[]", browser_context()));
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);
38 } // namespace extensions