OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/timer/mock_timer.h" | 8 #include "base/timer/mock_timer.h" |
9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
10 #include "chrome/browser/extensions/extension_function_test_utils.h" | 10 #include "chrome/browser/extensions/extension_function_test_utils.h" |
11 #include "chrome/browser/extensions/extension_service.h" | 11 #include "chrome/browser/extensions/extension_service.h" |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
14 #include "extensions/browser/api/cast_channel/cast_channel_api.h" | 14 #include "extensions/browser/api/cast_channel/cast_channel_api.h" |
15 #include "extensions/browser/api/cast_channel/cast_socket.h" | 15 #include "extensions/browser/api/cast_channel/cast_socket.h" |
16 #include "extensions/browser/api/cast_channel/cast_test_util.h" | 16 #include "extensions/browser/api/cast_channel/cast_test_util.h" |
17 #include "extensions/browser/api/cast_channel/logger.h" | 17 #include "extensions/browser/api/cast_channel/logger.h" |
18 #include "extensions/common/api/cast_channel.h" | 18 #include "extensions/common/api/cast_channel.h" |
19 #include "extensions/common/api/cast_channel/cast_channel.pb.h" | 19 #include "extensions/common/api/cast_channel/cast_channel.pb.h" |
20 #include "extensions/common/switches.h" | 20 #include "extensions/common/switches.h" |
21 #include "extensions/common/test_util.h" | 21 #include "extensions/common/test_util.h" |
22 #include "extensions/test/extension_test_message_listener.h" | 22 #include "extensions/test/extension_test_message_listener.h" |
23 #include "extensions/test/result_catcher.h" | 23 #include "extensions/test/result_catcher.h" |
24 #include "net/base/completion_callback.h" | 24 #include "net/base/completion_callback.h" |
25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
26 #include "net/log/capturing_net_log.h" | 26 #include "net/log/test_net_log.h" |
27 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
28 #include "testing/gmock_mutant.h" | 28 #include "testing/gmock_mutant.h" |
29 | 29 |
30 // TODO(mfoltz): Mock out the ApiResourceManager to resolve threading issues | 30 // TODO(mfoltz): Mock out the ApiResourceManager to resolve threading issues |
31 // (crbug.com/398242) and simulate unloading of the extension. | 31 // (crbug.com/398242) and simulate unloading of the extension. |
32 | 32 |
33 namespace cast_channel = extensions::core_api::cast_channel; | 33 namespace cast_channel = extensions::core_api::cast_channel; |
34 using cast_channel::CastMessage; | 34 using cast_channel::CastMessage; |
35 using cast_channel::CastSocket; | 35 using cast_channel::CastSocket; |
36 using cast_channel::CastTransport; | 36 using cast_channel::CastTransport; |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 new extensions::CastChannelSetAuthorityKeysFunction; | 225 new extensions::CastChannelSetAuthorityKeysFunction; |
226 cast_channel_set_authority_keys_function->set_extension(extension.get()); | 226 cast_channel_set_authority_keys_function->set_extension(extension.get()); |
227 return cast_channel_set_authority_keys_function; | 227 return cast_channel_set_authority_keys_function; |
228 } | 228 } |
229 | 229 |
230 MockCastSocket* mock_cast_socket_; | 230 MockCastSocket* mock_cast_socket_; |
231 base::MockTimer* timeout_timer_; | 231 base::MockTimer* timeout_timer_; |
232 net::IPEndPoint ip_endpoint_; | 232 net::IPEndPoint ip_endpoint_; |
233 LastErrors last_errors_; | 233 LastErrors last_errors_; |
234 CastTransport::Delegate* message_delegate_; | 234 CastTransport::Delegate* message_delegate_; |
235 net::CapturingNetLog capturing_net_log_; | 235 net::TestNetLog capturing_net_log_; |
236 int channel_id_; | 236 int channel_id_; |
237 }; | 237 }; |
238 | 238 |
239 ACTION_P2(InvokeDelegateOnError, api_test, api) { | 239 ACTION_P2(InvokeDelegateOnError, api_test, api) { |
240 content::BrowserThread::PostTask( | 240 content::BrowserThread::PostTask( |
241 content::BrowserThread::IO, FROM_HERE, | 241 content::BrowserThread::IO, FROM_HERE, |
242 base::Bind(&CastChannelAPITest::DoCallOnError, base::Unretained(api_test), | 242 base::Bind(&CastChannelAPITest::DoCallOnError, base::Unretained(api_test), |
243 base::Unretained(api))); | 243 base::Unretained(api))); |
244 } | 244 } |
245 | 245 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 #define MAYBE_TestSetAuthorityKeys DISABLED_TestSetAuthorityKeys | 609 #define MAYBE_TestSetAuthorityKeys DISABLED_TestSetAuthorityKeys |
610 #else | 610 #else |
611 #define MAYBE_TestSetAuthorityKeys TestSetAuthorityKeys | 611 #define MAYBE_TestSetAuthorityKeys TestSetAuthorityKeys |
612 #endif | 612 #endif |
613 // Test loading extension, opening a channel with ConnectInfo, adding a | 613 // Test loading extension, opening a channel with ConnectInfo, adding a |
614 // listener, writing, reading, and closing. | 614 // listener, writing, reading, and closing. |
615 IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestSetAuthorityKeys) { | 615 IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestSetAuthorityKeys) { |
616 EXPECT_TRUE( | 616 EXPECT_TRUE( |
617 RunExtensionSubtest("cast_channel/api", "test_authority_keys.html")); | 617 RunExtensionSubtest("cast_channel/api", "test_authority_keys.html")); |
618 } | 618 } |
OLD | NEW |