| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "extensions/browser/api/dns/host_resolver_wrapper.h" | 9 #include "extensions/browser/api/dns/host_resolver_wrapper.h" |
| 10 #include "extensions/browser/api/dns/mock_host_resolver_creator.h" | 10 #include "extensions/browser/api/dns/mock_host_resolver_creator.h" |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPCreateGood) { | 54 IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPCreateGood) { |
| 55 scoped_refptr<api::SocketsTcpServerCreateFunction> socket_create_function( | 55 scoped_refptr<api::SocketsTcpServerCreateFunction> socket_create_function( |
| 56 new api::SocketsTcpServerCreateFunction()); | 56 new api::SocketsTcpServerCreateFunction()); |
| 57 scoped_refptr<Extension> empty_extension(test_util::CreateEmptyExtension()); | 57 scoped_refptr<Extension> empty_extension(test_util::CreateEmptyExtension()); |
| 58 | 58 |
| 59 socket_create_function->set_extension(empty_extension.get()); | 59 socket_create_function->set_extension(empty_extension.get()); |
| 60 socket_create_function->set_has_callback(true); | 60 socket_create_function->set_has_callback(true); |
| 61 | 61 |
| 62 scoped_ptr<base::Value> result( | 62 std::unique_ptr<base::Value> result( |
| 63 api_test_utils::RunFunctionAndReturnSingleResult( | 63 api_test_utils::RunFunctionAndReturnSingleResult( |
| 64 socket_create_function.get(), "[]", browser_context())); | 64 socket_create_function.get(), "[]", browser_context())); |
| 65 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); | 65 ASSERT_EQ(base::Value::TYPE_DICTIONARY, result->GetType()); |
| 66 scoped_ptr<base::DictionaryValue> value = | 66 std::unique_ptr<base::DictionaryValue> value = |
| 67 base::DictionaryValue::From(std::move(result)); | 67 base::DictionaryValue::From(std::move(result)); |
| 68 int socketId = -1; | 68 int socketId = -1; |
| 69 EXPECT_TRUE(value->GetInteger("socketId", &socketId)); | 69 EXPECT_TRUE(value->GetInteger("socketId", &socketId)); |
| 70 ASSERT_TRUE(socketId > 0); | 70 ASSERT_TRUE(socketId > 0); |
| 71 } | 71 } |
| 72 | 72 |
| 73 IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPServerExtension) { | 73 IN_PROC_BROWSER_TEST_F(SocketsTcpServerApiTest, SocketTCPServerExtension) { |
| 74 ResultCatcher catcher; | 74 ResultCatcher catcher; |
| 75 catcher.RestrictToBrowserContext(browser_context()); | 75 catcher.RestrictToBrowserContext(browser_context()); |
| 76 ExtensionTestMessageListener listener("info_please", true); | 76 ExtensionTestMessageListener listener("info_please", true); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 91 ASSERT_TRUE(extension); | 91 ASSERT_TRUE(extension); |
| 92 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 92 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 93 | 93 |
| 94 UnloadApp(extension); | 94 UnloadApp(extension); |
| 95 | 95 |
| 96 ASSERT_TRUE(LoadApp(path)) << message_; | 96 ASSERT_TRUE(LoadApp(path)) << message_; |
| 97 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 97 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 } // namespace extensions | 100 } // namespace extensions |
| OLD | NEW |