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 "base/run_loop.h" |
10 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" | 10 #include "blimp/client/core/compositor/blimp_compositor_dependencies.h" |
11 #include "blimp/client/core/contents/blimp_contents_impl.h" | 11 #include "blimp/client/core/contents/blimp_contents_impl.h" |
12 #include "blimp/client/core/contents/ime_feature.h" | 12 #include "blimp/client/core/contents/ime_feature.h" |
13 #include "blimp/client/core/contents/tab_control_feature.h" | 13 #include "blimp/client/core/contents/tab_control_feature.h" |
14 #include "blimp/client/core/render_widget/render_widget_feature.h" | 14 #include "blimp/client/core/render_widget/render_widget_feature.h" |
15 #include "blimp/client/support/compositor/mock_compositor_dependencies.h" | 15 #include "blimp/client/support/compositor/mock_compositor_dependencies.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "ui/gfx/native_widget_types.h" | 18 #include "ui/gfx/native_widget_types.h" |
19 | 19 |
20 #if defined(OS_ANDROID) | 20 #if defined(OS_ANDROID) |
21 #include "ui/android/window_android.h" | 21 #include "ui/android/window_android.h" |
22 #endif // defined(OS_ANDROID) | 22 #endif // defined(OS_ANDROID) |
23 | 23 |
24 using testing::_; | 24 using testing::_; |
25 | 25 |
26 namespace { | 26 namespace { |
27 const int kDummyTabId = 0; | 27 const int kDummyBlimpContentsId = 0; |
28 } | 28 } |
29 | 29 |
30 namespace blimp { | 30 namespace blimp { |
31 namespace client { | 31 namespace client { |
32 namespace { | 32 namespace { |
33 | 33 |
34 class BlimpContentsManagerTest : public testing::Test { | 34 class BlimpContentsManagerTest : public testing::Test { |
35 public: | 35 public: |
36 BlimpContentsManagerTest() = default; | 36 BlimpContentsManagerTest() = default; |
37 | 37 |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 RenderWidgetFeature render_widget_feature; | 86 RenderWidgetFeature render_widget_feature; |
87 MockTabControlFeature tab_control_feature; | 87 MockTabControlFeature tab_control_feature; |
88 | 88 |
89 BlimpCompositorDependencies compositor_deps( | 89 BlimpCompositorDependencies compositor_deps( |
90 base::MakeUnique<MockCompositorDependencies>()); | 90 base::MakeUnique<MockCompositorDependencies>()); |
91 BlimpContentsManager blimp_contents_manager(&compositor_deps, &ime_feature, | 91 BlimpContentsManager blimp_contents_manager(&compositor_deps, &ime_feature, |
92 nullptr, &render_widget_feature, | 92 nullptr, &render_widget_feature, |
93 &tab_control_feature); | 93 &tab_control_feature); |
94 | 94 |
95 BlimpContentsImpl* existing_contents = | 95 BlimpContentsImpl* existing_contents = |
96 blimp_contents_manager.GetBlimpContents(kDummyTabId); | 96 blimp_contents_manager.GetBlimpContents(kDummyBlimpContentsId); |
97 EXPECT_EQ(nullptr, existing_contents); | 97 EXPECT_EQ(nullptr, existing_contents); |
98 } | 98 } |
99 | 99 |
100 TEST_F(BlimpContentsManagerTest, GetDestroyedBlimpContents) { | 100 TEST_F(BlimpContentsManagerTest, GetDestroyedBlimpContents) { |
101 base::MessageLoop loop; | 101 base::MessageLoop loop; |
102 ImeFeature ime_feature; | 102 ImeFeature ime_feature; |
103 RenderWidgetFeature render_widget_feature; | 103 RenderWidgetFeature render_widget_feature; |
104 MockTabControlFeature tab_control_feature; | 104 MockTabControlFeature tab_control_feature; |
105 BlimpCompositorDependencies compositor_deps( | 105 BlimpCompositorDependencies compositor_deps( |
106 base::MakeUnique<MockCompositorDependencies>()); | 106 base::MakeUnique<MockCompositorDependencies>()); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 | 147 |
148 blimp_contents.reset(); | 148 blimp_contents.reset(); |
149 std::unique_ptr<BlimpContentsImpl> third_blimp_contents = | 149 std::unique_ptr<BlimpContentsImpl> third_blimp_contents = |
150 blimp_contents_manager.CreateBlimpContents(window_); | 150 blimp_contents_manager.CreateBlimpContents(window_); |
151 EXPECT_NE(third_blimp_contents, nullptr); | 151 EXPECT_NE(third_blimp_contents, nullptr); |
152 } | 152 } |
153 | 153 |
154 } // namespace | 154 } // namespace |
155 } // namespace client | 155 } // namespace client |
156 } // namespace blimp | 156 } // namespace blimp |
OLD | NEW |