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

Side by Side Diff: components/bubble/bubble_manager_unittest.cc

Issue 1251633002: Add BubbleManager to manage bubbles and ChromeBubbleManager for events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Kill views_bubble_controller Created 5 years, 5 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
(Empty)
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.
4
5 #include "components/bubble/bubble_manager.h"
6
7 #include "components/bubble/bubble_builder.h"
8 #include "components/bubble/bubble_delegate.h"
9 #include "testing/gmock/include/gmock/gmock.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace {
13
14 class DelegateMock : public BubbleDelegate {
15 public:
16 MOCK_METHOD0(OnShow, void());
17 MOCK_METHOD0(OnHide, void());
18 MOCK_METHOD0(OnUpdatePosition, void());
19 MOCK_METHOD1(BuildBubble, void(BubbleBuilder*));
20 };
21
22 class BubbleManagerUnittest : public testing::Test {};
23
24 // Simple test to show and hide a bubble.
25 TEST_F(BubbleManagerUnittest, ShowAndHideBubble) {
26 BubbleManager manager;
27
28 DelegateMock delegate;
29 EXPECT_CALL(delegate, OnShow()).Times(1);
30 EXPECT_CALL(delegate, OnHide()).Times(1);
31
32 manager.ShowBubble(&delegate);
33 manager.HideBubble(&delegate);
34 }
35
36 // Simple test to show and hide more than one bubble.
37 TEST_F(BubbleManagerUnittest, ShowAndHide2Bubbles) {
38 BubbleManager manager;
39
40 DelegateMock delegate1,
41 delegate2;
42
43 EXPECT_CALL(delegate1, OnShow()).Times(1);
44 EXPECT_CALL(delegate1, OnHide()).Times(1);
45
46 EXPECT_CALL(delegate2, OnShow()).Times(1);
47 EXPECT_CALL(delegate2, OnHide()).Times(1);
48
49 manager.ShowBubble(&delegate1);
50 manager.ShowBubble(&delegate2);
51
52 manager.HideBubble(&delegate1);
53 manager.HideBubble(&delegate2);
54 }
55
56 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698