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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_
6 #define COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_
8 #include "components/bubble/bubble_delegate.h"
9 #include "components/bubble/bubble_reference.h"
10 #include "components/bubble/bubble_ui.h"
11 #include "testing/gmock/include/gmock/gmock.h"
13 class MockBubbleUi
: public BubbleUi
{
16 ~MockBubbleUi() override
;
18 MOCK_METHOD1(Show
, void(BubbleReference
));
19 MOCK_METHOD0(Close
, void());
20 MOCK_METHOD0(UpdateAnchorPosition
, void());
22 // To verify destructor call.
23 MOCK_METHOD0(Destroyed
, void());
26 DISALLOW_COPY_AND_ASSIGN(MockBubbleUi
);
29 class MockBubbleDelegate
: public BubbleDelegate
{
32 ~MockBubbleDelegate() override
;
34 // Default bubble shows UI and closes when asked to close.
35 static scoped_ptr
<MockBubbleDelegate
> Default();
37 // Stubborn bubble shows UI and doesn't want to close.
38 static scoped_ptr
<MockBubbleDelegate
> Stubborn();
40 MOCK_METHOD1(ShouldClose
, bool(BubbleCloseReason reason
));
42 // A scoped_ptr can't be returned in MOCK_METHOD.
43 MOCK_METHOD0(BuildBubbleUiMock
, BubbleUi
*());
44 scoped_ptr
<BubbleUi
> BuildBubbleUi() override
{
45 return make_scoped_ptr(BuildBubbleUiMock());
48 MOCK_METHOD1(UpdateBubbleUi
, bool(BubbleUi
*));
50 std::string
GetName() const override
{ return "MockBubble"; }
52 // To verify destructor call.
53 MOCK_METHOD0(Destroyed
, void());
56 DISALLOW_COPY_AND_ASSIGN(MockBubbleDelegate
);
59 #endif // COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_