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

Side by Side Diff: components/bubble/bubble_manager_mocks.h

Issue 1921973002: Convert //components/[a-e]* from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 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
« no previous file with comments | « components/bubble/bubble_manager.cc ('k') | components/bubble/bubble_manager_mocks.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_ 5 #ifndef COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_
6 #define COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_ 6 #define COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_
7 7
8 #include <memory>
8 #include <utility> 9 #include <utility>
9 10
10 #include "base/macros.h" 11 #include "base/macros.h"
11 #include "components/bubble/bubble_delegate.h" 12 #include "components/bubble/bubble_delegate.h"
12 #include "components/bubble/bubble_reference.h" 13 #include "components/bubble/bubble_reference.h"
13 #include "components/bubble/bubble_ui.h" 14 #include "components/bubble/bubble_ui.h"
14 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
15 16
16 class MockBubbleUi : public BubbleUi { 17 class MockBubbleUi : public BubbleUi {
17 public: 18 public:
(...skipping 10 matching lines...) Expand all
28 private: 29 private:
29 DISALLOW_COPY_AND_ASSIGN(MockBubbleUi); 30 DISALLOW_COPY_AND_ASSIGN(MockBubbleUi);
30 }; 31 };
31 32
32 class MockBubbleDelegate : public BubbleDelegate { 33 class MockBubbleDelegate : public BubbleDelegate {
33 public: 34 public:
34 MockBubbleDelegate(); 35 MockBubbleDelegate();
35 ~MockBubbleDelegate() override; 36 ~MockBubbleDelegate() override;
36 37
37 // Default bubble shows UI and closes when asked to close. 38 // Default bubble shows UI and closes when asked to close.
38 static scoped_ptr<MockBubbleDelegate> Default(); 39 static std::unique_ptr<MockBubbleDelegate> Default();
39 40
40 // Stubborn bubble shows UI and doesn't want to close. 41 // Stubborn bubble shows UI and doesn't want to close.
41 static scoped_ptr<MockBubbleDelegate> Stubborn(); 42 static std::unique_ptr<MockBubbleDelegate> Stubborn();
42 43
43 MOCK_CONST_METHOD1(ShouldClose, bool(BubbleCloseReason reason)); 44 MOCK_CONST_METHOD1(ShouldClose, bool(BubbleCloseReason reason));
44 MOCK_METHOD1(DidClose, void(BubbleCloseReason reason)); 45 MOCK_METHOD1(DidClose, void(BubbleCloseReason reason));
45 46
46 // A scoped_ptr can't be returned in MOCK_METHOD. 47 // A scoped_ptr can't be returned in MOCK_METHOD.
47 scoped_ptr<BubbleUi> BuildBubbleUi() override { 48 std::unique_ptr<BubbleUi> BuildBubbleUi() override {
48 return std::move(bubble_ui_); 49 return std::move(bubble_ui_);
49 } 50 }
50 51
51 MOCK_METHOD1(UpdateBubbleUi, bool(BubbleUi*)); 52 MOCK_METHOD1(UpdateBubbleUi, bool(BubbleUi*));
52 53
53 std::string GetName() const override { return "MockBubble"; } 54 std::string GetName() const override { return "MockBubble"; }
54 55
55 // To verify destructor call. 56 // To verify destructor call.
56 MOCK_METHOD0(Destroyed, void()); 57 MOCK_METHOD0(Destroyed, void());
57 58
58 // Will be null after |BubbleManager::ShowBubble| is called. 59 // Will be null after |BubbleManager::ShowBubble| is called.
59 MockBubbleUi* bubble_ui() { return bubble_ui_.get(); } 60 MockBubbleUi* bubble_ui() { return bubble_ui_.get(); }
60 61
61 MOCK_CONST_METHOD0(OwningFrame, const content::RenderFrameHost*()); 62 MOCK_CONST_METHOD0(OwningFrame, const content::RenderFrameHost*());
62 63
63 private: 64 private:
64 scoped_ptr<MockBubbleUi> bubble_ui_; 65 std::unique_ptr<MockBubbleUi> bubble_ui_;
65 66
66 DISALLOW_COPY_AND_ASSIGN(MockBubbleDelegate); 67 DISALLOW_COPY_AND_ASSIGN(MockBubbleDelegate);
67 }; 68 };
68 69
69 #endif // COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_ 70 #endif // COMPONENTS_BUBBLE_BUBBLE_MANAGER_MOCKS_H_
OLDNEW
« no previous file with comments | « components/bubble/bubble_manager.cc ('k') | components/bubble/bubble_manager_mocks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698