| 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 "base/run_loop.h" |
| 9 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" | 10 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" |
| 10 #include "blimp/client/core/contents/blimp_contents_impl.h" | 11 #include "blimp/client/core/contents/blimp_contents_impl.h" |
| 11 #include "blimp/client/core/contents/ime_feature.h" | 12 #include "blimp/client/core/contents/ime_feature.h" |
| 12 #include "blimp/client/core/contents/tab_control_feature.h" | 13 #include "blimp/client/core/contents/tab_control_feature.h" |
| 13 #include "blimp/client/core/render_widget/render_widget_feature.h" | 14 #include "blimp/client/core/render_widget/render_widget_feature.h" |
| 14 #include "blimp/client/support/compositor/mock_compositor_dependencies.h" | 15 #include "blimp/client/support/compositor/mock_compositor_dependencies.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
| 18 | 19 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 std::unique_ptr<BlimpContentsImpl> blimp_contents = | 113 std::unique_ptr<BlimpContentsImpl> blimp_contents = |
| 113 blimp_contents_manager.CreateBlimpContents(window_); | 114 blimp_contents_manager.CreateBlimpContents(window_); |
| 114 id = blimp_contents.get()->id(); | 115 id = blimp_contents.get()->id(); |
| 115 BlimpContentsImpl* existing_contents = | 116 BlimpContentsImpl* existing_contents = |
| 116 blimp_contents_manager.GetBlimpContents(id); | 117 blimp_contents_manager.GetBlimpContents(id); |
| 117 EXPECT_EQ(blimp_contents.get(), existing_contents); | 118 EXPECT_EQ(blimp_contents.get(), existing_contents); |
| 118 | 119 |
| 119 EXPECT_CALL(tab_control_feature, CloseTab(id)).Times(1); | 120 EXPECT_CALL(tab_control_feature, CloseTab(id)).Times(1); |
| 120 blimp_contents.reset(); | 121 blimp_contents.reset(); |
| 121 | 122 |
| 122 loop.RunUntilIdle(); | 123 base::RunLoop().RunUntilIdle(); |
| 123 EXPECT_EQ(nullptr, blimp_contents_manager.GetBlimpContents(id)); | 124 EXPECT_EQ(nullptr, blimp_contents_manager.GetBlimpContents(id)); |
| 124 } | 125 } |
| 125 | 126 |
| 126 // TODO(mlliu): remove this test case (http://crbug.com/642558) | 127 // TODO(mlliu): remove this test case (http://crbug.com/642558) |
| 127 TEST_F(BlimpContentsManagerTest, CreateTwoBlimpContentsDestroyAndCreate) { | 128 TEST_F(BlimpContentsManagerTest, CreateTwoBlimpContentsDestroyAndCreate) { |
| 128 base::MessageLoop loop; | 129 base::MessageLoop loop; |
| 129 ImeFeature ime_feature; | 130 ImeFeature ime_feature; |
| 130 RenderWidgetFeature render_widget_feature; | 131 RenderWidgetFeature render_widget_feature; |
| 131 MockTabControlFeature tab_control_feature; | 132 MockTabControlFeature tab_control_feature; |
| 132 BlimpCompositorDependencies compositor_deps( | 133 BlimpCompositorDependencies compositor_deps( |
| (...skipping 13 matching lines...) Expand all Loading... |
| 146 | 147 |
| 147 blimp_contents.reset(); | 148 blimp_contents.reset(); |
| 148 std::unique_ptr<BlimpContentsImpl> third_blimp_contents = | 149 std::unique_ptr<BlimpContentsImpl> third_blimp_contents = |
| 149 blimp_contents_manager.CreateBlimpContents(window_); | 150 blimp_contents_manager.CreateBlimpContents(window_); |
| 150 EXPECT_NE(third_blimp_contents, nullptr); | 151 EXPECT_NE(third_blimp_contents, nullptr); |
| 151 } | 152 } |
| 152 | 153 |
| 153 } // namespace | 154 } // namespace |
| 154 } // namespace client | 155 } // namespace client |
| 155 } // namespace blimp | 156 } // namespace blimp |
| OLD | NEW |