| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "extensions/browser/api/display_source/display_source_apitestbase.h" |
| 6 |
| 5 #include <map> | 7 #include <map> |
| 6 #include <utility> | 8 #include <utility> |
| 7 | 9 |
| 8 #include "extensions/browser/api/display_source/display_source_apitestbase.h" | 10 #include "base/memory/ptr_util.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 12 |
| 11 namespace extensions { | 13 namespace extensions { |
| 12 | 14 |
| 13 using api::display_source::SinkInfo; | 15 using api::display_source::SinkInfo; |
| 14 using api::display_source::SinkState; | 16 using api::display_source::SinkState; |
| 15 using api::display_source::AuthenticationMethod; | 17 using api::display_source::AuthenticationMethod; |
| 16 using api::display_source::SINK_STATE_DISCONNECTED; | 18 using api::display_source::SINK_STATE_DISCONNECTED; |
| 17 using api::display_source::SINK_STATE_CONNECTING; | 19 using api::display_source::SINK_STATE_CONNECTING; |
| 18 using api::display_source::SINK_STATE_CONNECTED; | 20 using api::display_source::SINK_STATE_CONNECTED; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 109 |
| 108 DisplaySourceSinkInfo CreateSinkInfo(int id, const std::string& name) { | 110 DisplaySourceSinkInfo CreateSinkInfo(int id, const std::string& name) { |
| 109 DisplaySourceSinkInfo ptr; | 111 DisplaySourceSinkInfo ptr; |
| 110 ptr.id = id; | 112 ptr.id = id; |
| 111 ptr.name = name; | 113 ptr.name = name; |
| 112 ptr.state = SINK_STATE_DISCONNECTED; | 114 ptr.state = SINK_STATE_DISCONNECTED; |
| 113 | 115 |
| 114 return ptr; | 116 return ptr; |
| 115 } | 117 } |
| 116 | 118 |
| 117 scoped_ptr<KeyedService> CreateMockDelegate(content::BrowserContext* profile) { | 119 std::unique_ptr<KeyedService> CreateMockDelegate( |
| 118 return make_scoped_ptr<KeyedService>( | 120 content::BrowserContext* profile) { |
| 119 new MockDisplaySourceConnectionDelegate()); | 121 return base::WrapUnique<KeyedService>( |
| 122 new MockDisplaySourceConnectionDelegate()); |
| 120 } | 123 } |
| 121 | 124 |
| 122 } // namespace | 125 } // namespace |
| 123 | 126 |
| 124 void InitMockDisplaySourceConnectionDelegate(content::BrowserContext* profile) { | 127 void InitMockDisplaySourceConnectionDelegate(content::BrowserContext* profile) { |
| 125 DisplaySourceConnectionDelegateFactory::GetInstance()->SetTestingFactory( | 128 DisplaySourceConnectionDelegateFactory::GetInstance()->SetTestingFactory( |
| 126 profile, &CreateMockDelegate); | 129 profile, &CreateMockDelegate); |
| 127 } | 130 } |
| 128 namespace { | 131 namespace { |
| 129 | 132 |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 377 const std::size_t session_id_pos = found + | 380 const std::size_t session_id_pos = found + |
| 378 std::char_traits<char>::length(kSessionKey); | 381 std::char_traits<char>::length(kSessionKey); |
| 379 session_id_ = message.substr(session_id_pos, kSessionIdLength); | 382 session_id_ = message.substr(session_id_pos, kSessionIdLength); |
| 380 | 383 |
| 381 pattern.replace(session_id_pos, kSessionIdLength, session_id_); | 384 pattern.replace(session_id_pos, kSessionIdLength, session_id_); |
| 382 } | 385 } |
| 383 ASSERT_EQ(pattern, message); | 386 ASSERT_EQ(pattern, message); |
| 384 } | 387 } |
| 385 | 388 |
| 386 } // namespace extensions | 389 } // namespace extensions |
| OLD | NEW |