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