OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/mime_handler_private/mime_handler_private.h" | 5 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 void SetUp() override { | 44 void SetUp() override { |
45 std::unique_ptr<content::StreamInfo> stream_info(new content::StreamInfo); | 45 std::unique_ptr<content::StreamInfo> stream_info(new content::StreamInfo); |
46 stream_info->handle = base::WrapUnique(new TestStreamHandle); | 46 stream_info->handle = base::WrapUnique(new TestStreamHandle); |
47 stream_info->mime_type = "test/unit"; | 47 stream_info->mime_type = "test/unit"; |
48 stream_info->original_url = GURL("test://extensions_unittests"); | 48 stream_info->original_url = GURL("test://extensions_unittests"); |
49 stream_container_.reset( | 49 stream_container_.reset( |
50 new StreamContainer(std::move(stream_info), 1, true, GURL(), "")); | 50 new StreamContainer(std::move(stream_info), 1, true, GURL(), "")); |
51 service_binding_ = | 51 service_binding_ = |
52 mojo::MakeStrongBinding(base::MakeUnique<MimeHandlerServiceImpl>( | 52 mojo::MakeStrongBinding(base::MakeUnique<MimeHandlerServiceImpl>( |
53 stream_container_->GetWeakPtr()), | 53 stream_container_->GetWeakPtr()), |
54 mojo::GetProxy(&service_ptr_)); | 54 mojo::MakeRequest(&service_ptr_)); |
55 } | 55 } |
56 void TearDown() override { | 56 void TearDown() override { |
57 service_binding_->Close(); | 57 service_binding_->Close(); |
58 stream_container_.reset(); | 58 stream_container_.reset(); |
59 } | 59 } |
60 | 60 |
61 void AbortCallback() { abort_called_ = true; } | 61 void AbortCallback() { abort_called_ = true; } |
62 void GetStreamInfoCallback(mime_handler::StreamInfoPtr stream_info) { | 62 void GetStreamInfoCallback(mime_handler::StreamInfoPtr stream_info) { |
63 stream_info_ = std::move(stream_info); | 63 stream_info_ = std::move(stream_info); |
64 } | 64 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 ASSERT_FALSE(stream_info_); | 108 ASSERT_FALSE(stream_info_); |
109 | 109 |
110 stream_container_.reset(); | 110 stream_container_.reset(); |
111 service_binding_->impl()->GetStreamInfo( | 111 service_binding_->impl()->GetStreamInfo( |
112 base::Bind(&MimeHandlerServiceImplTest::GetStreamInfoCallback, | 112 base::Bind(&MimeHandlerServiceImplTest::GetStreamInfoCallback, |
113 base::Unretained(this))); | 113 base::Unretained(this))); |
114 ASSERT_FALSE(stream_info_); | 114 ASSERT_FALSE(stream_info_); |
115 } | 115 } |
116 | 116 |
117 } // namespace extensions | 117 } // namespace extensions |
OLD | NEW |