Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Side by Side Diff: extensions/browser/api/cast_channel/cast_channel_apitest.cc

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/memory/ptr_util.h"
8 #include "base/timer/mock_timer.h" 9 #include "base/timer/mock_timer.h"
9 #include "build/build_config.h" 10 #include "build/build_config.h"
10 #include "chrome/browser/extensions/extension_apitest.h" 11 #include "chrome/browser/extensions/extension_apitest.h"
11 #include "chrome/browser/extensions/extension_function_test_utils.h" 12 #include "chrome/browser/extensions/extension_function_test_utils.h"
12 #include "chrome/browser/extensions/extension_service.h" 13 #include "chrome/browser/extensions/extension_service.h"
13 #include "chrome/browser/ui/browser.h" 14 #include "chrome/browser/ui/browser.h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "extensions/browser/api/cast_channel/cast_channel_api.h" 16 #include "extensions/browser/api/cast_channel/cast_channel_api.h"
16 #include "extensions/browser/api/cast_channel/cast_socket.h" 17 #include "extensions/browser/api/cast_channel/cast_socket.h"
17 #include "extensions/browser/api/cast_channel/cast_test_util.h" 18 #include "extensions/browser/api/cast_channel/cast_test_util.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void SetUpCommandLine(base::CommandLine* command_line) override { 88 void SetUpCommandLine(base::CommandLine* command_line) override {
88 ExtensionApiTest::SetUpCommandLine(command_line); 89 ExtensionApiTest::SetUpCommandLine(command_line);
89 command_line->AppendSwitchASCII( 90 command_line->AppendSwitchASCII(
90 extensions::switches::kWhitelistedExtensionID, 91 extensions::switches::kWhitelistedExtensionID,
91 cast_channel::kTestExtensionId); 92 cast_channel::kTestExtensionId);
92 } 93 }
93 94
94 void SetUpMockCastSocket() { 95 void SetUpMockCastSocket() {
95 extensions::CastChannelAPI* api = GetApi(); 96 extensions::CastChannelAPI* api = GetApi();
96 timeout_timer_ = new base::MockTimer(true, false); 97 timeout_timer_ = new base::MockTimer(true, false);
97 api->SetPingTimeoutTimerForTest(make_scoped_ptr(timeout_timer_)); 98 api->SetPingTimeoutTimerForTest(base::WrapUnique(timeout_timer_));
98 99
99 net::IPEndPoint ip_endpoint(net::IPAddress(192, 168, 1, 1), 8009); 100 net::IPEndPoint ip_endpoint(net::IPAddress(192, 168, 1, 1), 8009);
100 mock_cast_socket_ = new MockCastSocket; 101 mock_cast_socket_ = new MockCastSocket;
101 // Transfers ownership of the socket. 102 // Transfers ownership of the socket.
102 api->SetSocketForTest(make_scoped_ptr<CastSocket>(mock_cast_socket_)); 103 api->SetSocketForTest(base::WrapUnique<CastSocket>(mock_cast_socket_));
103 ON_CALL(*mock_cast_socket_, set_id(_)) 104 ON_CALL(*mock_cast_socket_, set_id(_))
104 .WillByDefault(SaveArg<0>(&channel_id_)); 105 .WillByDefault(SaveArg<0>(&channel_id_));
105 ON_CALL(*mock_cast_socket_, id()) 106 ON_CALL(*mock_cast_socket_, id())
106 .WillByDefault(ReturnPointee(&channel_id_)); 107 .WillByDefault(ReturnPointee(&channel_id_));
107 ON_CALL(*mock_cast_socket_, ip_endpoint()) 108 ON_CALL(*mock_cast_socket_, ip_endpoint())
108 .WillByDefault(ReturnRef(ip_endpoint_)); 109 .WillByDefault(ReturnRef(ip_endpoint_));
109 ON_CALL(*mock_cast_socket_, channel_auth()) 110 ON_CALL(*mock_cast_socket_, channel_auth())
110 .WillByDefault(Return(cast_channel::CHANNEL_AUTH_TYPE_SSL)); 111 .WillByDefault(Return(cast_channel::CHANNEL_AUTH_TYPE_SSL));
111 ON_CALL(*mock_cast_socket_, keep_alive()).WillByDefault(Return(false)); 112 ON_CALL(*mock_cast_socket_, keep_alive()).WillByDefault(Return(false));
112 } 113 }
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 #define MAYBE_TestSetAuthorityKeys DISABLED_TestSetAuthorityKeys 575 #define MAYBE_TestSetAuthorityKeys DISABLED_TestSetAuthorityKeys
575 #else 576 #else
576 #define MAYBE_TestSetAuthorityKeys TestSetAuthorityKeys 577 #define MAYBE_TestSetAuthorityKeys TestSetAuthorityKeys
577 #endif 578 #endif
578 // Test loading extension, opening a channel with ConnectInfo, adding a 579 // Test loading extension, opening a channel with ConnectInfo, adding a
579 // listener, writing, reading, and closing. 580 // listener, writing, reading, and closing.
580 IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestSetAuthorityKeys) { 581 IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestSetAuthorityKeys) {
581 EXPECT_TRUE( 582 EXPECT_TRUE(
582 RunExtensionSubtest("cast_channel/api", "test_authority_keys.html")); 583 RunExtensionSubtest("cast_channel/api", "test_authority_keys.html"));
583 } 584 }
OLDNEW
« no previous file with comments | « extensions/browser/api/cast_channel/cast_channel_api_unittest.cc ('k') | extensions/browser/api/cast_channel/cast_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698