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

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

Issue 2201433002: Migrate TabControlFeature from 0.5 to 0.6 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: some more compile error fix 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
new file mode 100644
index 0000000000000000000000000000000000000000..422b77157ef9c49bbfd94dfc69fb02b1109ef2d3
--- /dev/null
+++ b/blimp/client/core/contents/blimp_contents_manager_unittest.cc
@@ -0,0 +1,59 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/client/core/contents/blimp_contents_manager.h"
+
+#include "base/memory/ptr_util.h"
+#include "base/message_loop/message_loop.h"
+#include "blimp/client/core/contents/blimp_contents_impl.h"
+#include "testing/gtest/include/gtest/gtest.h"
+
+namespace {
+const int kDummyTabId = 0;
+}
+
+namespace blimp {
+namespace client {
+namespace {
+
+TEST(BlimpContentsManagerUnittest, GetExistingBlimpContents) {
+ base::MessageLoop loop;
+ BlimpContentsManager blimp_contents_manager;
+
+ std::unique_ptr<BlimpContentsImpl> blimp_contents =
+ blimp_contents_manager.CreateBlimpContents();
+ int id = blimp_contents->id();
+ BlimpContentsImpl* existing_contents =
+ blimp_contents_manager.GetBlimpContents(id);
+ EXPECT_EQ(blimp_contents.get(), existing_contents);
+}
+
+TEST(BlimpContentsManagerUnittest, GetNonExistingBlimpContents) {
+ BlimpContentsManager blimp_contents_manager;
+
+ BlimpContentsImpl* existing_contents =
+ blimp_contents_manager.GetBlimpContents(kDummyTabId);
+ EXPECT_EQ(nullptr, existing_contents);
+}
+
+TEST(BlimpContentsManagerUnittest, GetDestroyedBlimpContents) {
+ base::MessageLoop loop;
+ BlimpContentsManager blimp_contents_manager;
+ int id;
+
+ 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);
+ blimp_contents.reset();
+
+ loop.RunUntilIdle();
+ EXPECT_EQ(nullptr, blimp_contents_manager.GetBlimpContents(id));
+}
+
+} // namespace
+} // namespace client
+} // namespace blimp
« 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