| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "blimp/client/core/contents/blimp_contents_manager.h" | 5 #include "blimp/client/core/contents/blimp_contents_manager.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "blimp/client/core/contents/blimp_contents_impl.h" | 9 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 10 #include "blimp/client/core/contents/tab_control_feature.h" | 10 #include "blimp/client/core/contents/tab_control_feature.h" |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 blimp_contents_manager.GetBlimpContents(id); | 75 blimp_contents_manager.GetBlimpContents(id); |
| 76 EXPECT_EQ(blimp_contents.get(), existing_contents); | 76 EXPECT_EQ(blimp_contents.get(), existing_contents); |
| 77 | 77 |
| 78 EXPECT_CALL(tab_control_feature, CloseTab(id)).Times(1); | 78 EXPECT_CALL(tab_control_feature, CloseTab(id)).Times(1); |
| 79 blimp_contents.reset(); | 79 blimp_contents.reset(); |
| 80 | 80 |
| 81 loop.RunUntilIdle(); | 81 loop.RunUntilIdle(); |
| 82 EXPECT_EQ(nullptr, blimp_contents_manager.GetBlimpContents(id)); | 82 EXPECT_EQ(nullptr, blimp_contents_manager.GetBlimpContents(id)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 // TODO(mlliu): remove this test case (http://crbug.com/642558) |
| 86 TEST(BlimpContentsManagerUnittest, CreateTwoBlimpContentsDestroyAndCreate) { |
| 87 base::MessageLoop loop; |
| 88 MockTabControlFeature tab_control_feature; |
| 89 BlimpContentsManager blimp_contents_manager(nullptr, nullptr, |
| 90 &tab_control_feature); |
| 91 |
| 92 EXPECT_CALL(tab_control_feature, CreateTab(_)).Times(2); |
| 93 std::unique_ptr<BlimpContentsImpl> blimp_contents = |
| 94 blimp_contents_manager.CreateBlimpContents(); |
| 95 EXPECT_NE(blimp_contents, nullptr); |
| 96 |
| 97 std::unique_ptr<BlimpContentsImpl> second_blimp_contents = |
| 98 blimp_contents_manager.CreateBlimpContents(); |
| 99 EXPECT_EQ(second_blimp_contents, nullptr); |
| 100 |
| 101 blimp_contents.reset(); |
| 102 std::unique_ptr<BlimpContentsImpl> third_blimp_contents = |
| 103 blimp_contents_manager.CreateBlimpContents(); |
| 104 EXPECT_NE(third_blimp_contents, nullptr); |
| 105 } |
| 106 |
| 85 } // namespace | 107 } // namespace |
| 86 } // namespace client | 108 } // namespace client |
| 87 } // namespace blimp | 109 } // namespace blimp |
| OLD | NEW |