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

Unified Diff: blimp/client/core/contents/blimp_contents_manager_unittest.cc

Issue 2255533002: Add TabControlFeature to BlimpClientContextImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync to head Created 4 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: blimp/client/core/contents/blimp_contents_manager_unittest.cc
diff --git a/blimp/client/core/contents/blimp_contents_manager_unittest.cc b/blimp/client/core/contents/blimp_contents_manager_unittest.cc
index 422b77157ef9c49bbfd94dfc69fb02b1109ef2d3..f87040ee69d7bcd740cd3e9e5cca081e33527d44 100644
--- a/blimp/client/core/contents/blimp_contents_manager_unittest.cc
+++ b/blimp/client/core/contents/blimp_contents_manager_unittest.cc
@@ -7,8 +7,12 @@
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_loop.h"
#include "blimp/client/core/contents/blimp_contents_impl.h"
+#include "blimp/client/core/contents/tab_control_feature.h"
+#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using testing::_;
+
namespace {
const int kDummyTabId = 0;
}
@@ -17,10 +21,25 @@ namespace blimp {
namespace client {
namespace {
+class MockTabControlFeature : public TabControlFeature {
+ public:
+ MockTabControlFeature() {}
+ ~MockTabControlFeature() override = default;
+
+ MOCK_METHOD1(CreateTab, void(int));
+ MOCK_METHOD1(CloseTab, void(int));
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(MockTabControlFeature);
+};
+
TEST(BlimpContentsManagerUnittest, GetExistingBlimpContents) {
base::MessageLoop loop;
- BlimpContentsManager blimp_contents_manager;
+ MockTabControlFeature tab_control_feature;
+ BlimpContentsManager blimp_contents_manager(&tab_control_feature);
+
+ EXPECT_CALL(tab_control_feature, CreateTab(_)).Times(1);
std::unique_ptr<BlimpContentsImpl> blimp_contents =
blimp_contents_manager.CreateBlimpContents();
int id = blimp_contents->id();
@@ -30,7 +49,9 @@ TEST(BlimpContentsManagerUnittest, GetExistingBlimpContents) {
}
TEST(BlimpContentsManagerUnittest, GetNonExistingBlimpContents) {
- BlimpContentsManager blimp_contents_manager;
+ MockTabControlFeature tab_control_feature;
+
+ BlimpContentsManager blimp_contents_manager(&tab_control_feature);
BlimpContentsImpl* existing_contents =
blimp_contents_manager.GetBlimpContents(kDummyTabId);
@@ -39,15 +60,19 @@ TEST(BlimpContentsManagerUnittest, GetNonExistingBlimpContents) {
TEST(BlimpContentsManagerUnittest, GetDestroyedBlimpContents) {
base::MessageLoop loop;
- BlimpContentsManager blimp_contents_manager;
+ MockTabControlFeature tab_control_feature;
+ BlimpContentsManager blimp_contents_manager(&tab_control_feature);
int id;
+ EXPECT_CALL(tab_control_feature, CreateTab(_)).Times(1);
std::unique_ptr<BlimpContentsImpl> blimp_contents =
blimp_contents_manager.CreateBlimpContents();
id = blimp_contents.get()->id();
BlimpContentsImpl* existing_contents =
blimp_contents_manager.GetBlimpContents(id);
EXPECT_EQ(blimp_contents.get(), existing_contents);
+
+ EXPECT_CALL(tab_control_feature, CloseTab(id)).Times(1);
blimp_contents.reset();
loop.RunUntilIdle();
« no previous file with comments | « blimp/client/core/contents/blimp_contents_manager.cc ('k') | blimp/client/core/contents/blimp_contents_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698