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

Side by Side Diff: extensions/browser/api/mime_handler_private/mime_handler_private_unittest.cc

Issue 1148703002: Remove mojo::InterfaceImpl from extensions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "content/public/browser/stream_handle.h" 6 #include "content/public/browser/stream_handle.h"
7 #include "content/public/browser/stream_info.h" 7 #include "content/public/browser/stream_info.h"
8 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h" 8 #include "extensions/browser/api/mime_handler_private/mime_handler_private.h"
9 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h" 9 #include "extensions/browser/guest_view/mime_handler_view/mime_handler_view_gues t.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 24 matching lines...) Expand all
35 35
36 class MimeHandlerServiceImplTest : public testing::Test { 36 class MimeHandlerServiceImplTest : public testing::Test {
37 public: 37 public:
38 void SetUp() override { 38 void SetUp() override {
39 scoped_ptr<content::StreamInfo> stream_info(new content::StreamInfo); 39 scoped_ptr<content::StreamInfo> stream_info(new content::StreamInfo);
40 stream_info->handle = make_scoped_ptr(new TestStreamHandle); 40 stream_info->handle = make_scoped_ptr(new TestStreamHandle);
41 stream_info->mime_type = "test/unit"; 41 stream_info->mime_type = "test/unit";
42 stream_info->original_url = GURL("test://extensions_unittests"); 42 stream_info->original_url = GURL("test://extensions_unittests");
43 stream_container_.reset( 43 stream_container_.reset(
44 new StreamContainer(stream_info.Pass(), 1, true, GURL(), "")); 44 new StreamContainer(stream_info.Pass(), 1, true, GURL(), ""));
45 service_.reset(new MimeHandlerServiceImpl(stream_container_->GetWeakPtr())); 45 service_.reset(new MimeHandlerServiceImpl(stream_container_->GetWeakPtr(),
46 mojo::GetProxy(&service_ptr_)));
46 } 47 }
47 void TearDown() override { 48 void TearDown() override {
48 service_.reset(); 49 service_.reset();
49 stream_container_.reset(); 50 stream_container_.reset();
50 } 51 }
51 52
52 void AbortCallback() { abort_called_ = true; } 53 void AbortCallback() { abort_called_ = true; }
53 void GetStreamInfoCallback(mime_handler::StreamInfoPtr stream_info) { 54 void GetStreamInfoCallback(mime_handler::StreamInfoPtr stream_info) {
54 stream_info_ = stream_info.Pass(); 55 stream_info_ = stream_info.Pass();
55 } 56 }
56 57
58 base::MessageLoop message_loop_;
57 scoped_ptr<StreamContainer> stream_container_; 59 scoped_ptr<StreamContainer> stream_container_;
60 mime_handler::MimeHandlerServicePtr service_ptr_;
58 scoped_ptr<mime_handler::MimeHandlerService> service_; 61 scoped_ptr<mime_handler::MimeHandlerService> service_;
59 bool abort_called_ = false; 62 bool abort_called_ = false;
60 mime_handler::StreamInfoPtr stream_info_; 63 mime_handler::StreamInfoPtr stream_info_;
61 }; 64 };
62 65
63 TEST_F(MimeHandlerServiceImplTest, Abort) { 66 TEST_F(MimeHandlerServiceImplTest, Abort) {
64 service_->AbortStream(base::Bind(&MimeHandlerServiceImplTest::AbortCallback, 67 service_->AbortStream(base::Bind(&MimeHandlerServiceImplTest::AbortCallback,
65 base::Unretained(this))); 68 base::Unretained(this)));
66 EXPECT_TRUE(abort_called_); 69 EXPECT_TRUE(abort_called_);
67 70
(...skipping 29 matching lines...) Expand all
97 ASSERT_FALSE(stream_info_); 100 ASSERT_FALSE(stream_info_);
98 101
99 stream_container_.reset(); 102 stream_container_.reset();
100 service_->GetStreamInfo( 103 service_->GetStreamInfo(
101 base::Bind(&MimeHandlerServiceImplTest::GetStreamInfoCallback, 104 base::Bind(&MimeHandlerServiceImplTest::GetStreamInfoCallback,
102 base::Unretained(this))); 105 base::Unretained(this)));
103 ASSERT_FALSE(stream_info_); 106 ASSERT_FALSE(stream_info_);
104 } 107 }
105 108
106 } // namespace extensions 109 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/api/mime_handler_private/mime_handler_private.cc ('k') | extensions/browser/mojo/keep_alive_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698