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 "components/bubble/bubble_manager_mocks.h" | 5 #include "components/bubble/bubble_manager_mocks.h" |
6 | 6 |
| 7 #include "base/memory/ptr_util.h" |
| 8 |
7 MockBubbleUi::MockBubbleUi() {} | 9 MockBubbleUi::MockBubbleUi() {} |
8 | 10 |
9 MockBubbleUi::~MockBubbleUi() { Destroyed(); } | 11 MockBubbleUi::~MockBubbleUi() { Destroyed(); } |
10 | 12 |
11 MockBubbleDelegate::MockBubbleDelegate() : bubble_ui_(new MockBubbleUi) {} | 13 MockBubbleDelegate::MockBubbleDelegate() : bubble_ui_(new MockBubbleUi) {} |
12 | 14 |
13 MockBubbleDelegate::~MockBubbleDelegate() { Destroyed(); } | 15 MockBubbleDelegate::~MockBubbleDelegate() { Destroyed(); } |
14 | 16 |
15 // static | 17 // static |
16 scoped_ptr<MockBubbleDelegate> MockBubbleDelegate::Default() { | 18 std::unique_ptr<MockBubbleDelegate> MockBubbleDelegate::Default() { |
17 MockBubbleDelegate* delegate = new MockBubbleDelegate; | 19 MockBubbleDelegate* delegate = new MockBubbleDelegate; |
18 EXPECT_CALL(*delegate, ShouldClose(testing::_)) | 20 EXPECT_CALL(*delegate, ShouldClose(testing::_)) |
19 .Times(testing::AtMost(1)) | 21 .Times(testing::AtMost(1)) |
20 .WillRepeatedly(testing::Return(true)); | 22 .WillRepeatedly(testing::Return(true)); |
21 EXPECT_CALL(*delegate, DidClose(testing::_)); | 23 EXPECT_CALL(*delegate, DidClose(testing::_)); |
22 EXPECT_CALL(*delegate, Destroyed()); | 24 EXPECT_CALL(*delegate, Destroyed()); |
23 return make_scoped_ptr(delegate); | 25 return base::WrapUnique(delegate); |
24 } | 26 } |
25 | 27 |
26 // static | 28 // static |
27 scoped_ptr<MockBubbleDelegate> MockBubbleDelegate::Stubborn() { | 29 std::unique_ptr<MockBubbleDelegate> MockBubbleDelegate::Stubborn() { |
28 MockBubbleDelegate* delegate = new MockBubbleDelegate; | 30 MockBubbleDelegate* delegate = new MockBubbleDelegate; |
29 EXPECT_CALL(*delegate, ShouldClose(testing::_)) | 31 EXPECT_CALL(*delegate, ShouldClose(testing::_)) |
30 .WillRepeatedly(testing::Return(false)); | 32 .WillRepeatedly(testing::Return(false)); |
31 EXPECT_CALL(*delegate, DidClose(testing::_)); | 33 EXPECT_CALL(*delegate, DidClose(testing::_)); |
32 EXPECT_CALL(*delegate, Destroyed()); | 34 EXPECT_CALL(*delegate, Destroyed()); |
33 return make_scoped_ptr(delegate); | 35 return base::WrapUnique(delegate); |
34 } | 36 } |
OLD | NEW |