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

Unified Diff: components/bubble/bubble_manager_unittest.cc

Issue 1310483003: Add ability for a BubbleReference to update the BubbleUI. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bm-reference-own-file.gitbr
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/bubble/bubble_manager_unittest.cc
diff --git a/components/bubble/bubble_manager_unittest.cc b/components/bubble/bubble_manager_unittest.cc
index 84ed380aa31a6b33c76c4ff12d2f0da3851801a7..be347b1a09fcc811dbaf3937d7385011441edfea 100644
--- a/components/bubble/bubble_manager_unittest.cc
+++ b/components/bubble/bubble_manager_unittest.cc
@@ -6,6 +6,7 @@
#include "components/bubble/bubble_controller.h"
#include "components/bubble/bubble_delegate.h"
+#include "components/bubble/bubble_reference.h"
#include "components/bubble/bubble_ui.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -44,6 +45,8 @@ class MockBubbleDelegate : public BubbleDelegate {
return make_scoped_ptr(BuildBubbleUIMock());
}
+ MOCK_METHOD1(UpdateBubbleUI, bool(BubbleUI*));
+
// To verify destructor call.
MOCK_METHOD0(Destroyed, void());
};
@@ -344,4 +347,32 @@ TEST_F(BubbleManagerTest, BubblesDoNotChainOnDestroy) {
ASSERT_TRUE(chain_helper.BubbleWasTaken());
}
+TEST_F(BubbleManagerTest, BubbleUpdatesTrue) {
+ MockBubbleUI* bubble_ui = new MockBubbleUI;
+ MockBubbleDelegate* delegate = new MockBubbleDelegate;
+ EXPECT_CALL(*delegate, BuildBubbleUIMock())
+ .WillOnce(testing::Return(bubble_ui));
+ EXPECT_CALL(*delegate, ShouldClose(testing::_))
+ .WillOnce(testing::Return(true));
+ EXPECT_CALL(*delegate, UpdateBubbleUI(bubble_ui))
+ .WillOnce(testing::Return(true));
+
+ BubbleReference ref = manager_->ShowBubble(make_scoped_ptr(delegate));
+ ASSERT_TRUE(ref->UpdateBubbleUI());
+}
+
+TEST_F(BubbleManagerTest, BubbleUpdatesFalse) {
+ MockBubbleUI* bubble_ui = new MockBubbleUI;
+ MockBubbleDelegate* delegate = new MockBubbleDelegate;
+ EXPECT_CALL(*delegate, BuildBubbleUIMock())
+ .WillOnce(testing::Return(bubble_ui));
+ EXPECT_CALL(*delegate, ShouldClose(testing::_))
+ .WillOnce(testing::Return(true));
+ EXPECT_CALL(*delegate, UpdateBubbleUI(bubble_ui))
+ .WillOnce(testing::Return(false));
+
+ BubbleReference ref = manager_->ShowBubble(make_scoped_ptr(delegate));
+ ASSERT_FALSE(ref->UpdateBubbleUI());
+}
+
} // namespace
« components/bubble/bubble_controller.cc ('K') | « components/bubble/bubble_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698