| 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/blimp_client_context_impl.h" | 5 #include "blimp/client/core/blimp_client_context_impl.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" |
| 8 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 9 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 10 #include "base/threading/thread.h" | 11 #include "base/threading/thread.h" |
| 11 #include "blimp/client/core/contents/blimp_contents_impl.h" | 12 #include "blimp/client/core/contents/blimp_contents_impl.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/public/blimp_client_context_delegate.h" | 14 #include "blimp/client/public/blimp_client_context_delegate.h" |
| 14 #include "blimp/client/public/contents/blimp_contents.h" | 15 #include "blimp/client/public/contents/blimp_contents.h" |
| 16 #include "blimp/client/support/compositor/mock_compositor_dependencies.h" |
| 15 #include "blimp/client/test/test_blimp_client_context_delegate.h" | 17 #include "blimp/client/test/test_blimp_client_context_delegate.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 20 |
| 19 namespace blimp { | 21 namespace blimp { |
| 20 namespace client { | 22 namespace client { |
| 21 namespace { | 23 namespace { |
| 22 | 24 |
| 23 class BlimpClientContextImplTest : public testing::Test { | 25 class BlimpClientContextImplTest : public testing::Test { |
| 24 public: | 26 public: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 40 base::Thread io_thread_; | 42 base::Thread io_thread_; |
| 41 | 43 |
| 42 private: | 44 private: |
| 43 base::MessageLoop message_loop_; | 45 base::MessageLoop message_loop_; |
| 44 | 46 |
| 45 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImplTest); | 47 DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImplTest); |
| 46 }; | 48 }; |
| 47 | 49 |
| 48 TEST_F(BlimpClientContextImplTest, | 50 TEST_F(BlimpClientContextImplTest, |
| 49 CreatedBlimpContentsGetsHelpersAttachedAndHasTabControlFeature) { | 51 CreatedBlimpContentsGetsHelpersAttachedAndHasTabControlFeature) { |
| 50 BlimpClientContextImpl blimp_client_context(io_thread_.task_runner(), | 52 BlimpClientContextImpl blimp_client_context( |
| 51 io_thread_.task_runner()); | 53 io_thread_.task_runner(), io_thread_.task_runner(), |
| 54 base::MakeUnique<MockCompositorDependencies>()); |
| 52 TestBlimpClientContextDelegate delegate; | 55 TestBlimpClientContextDelegate delegate; |
| 53 blimp_client_context.SetDelegate(&delegate); | 56 blimp_client_context.SetDelegate(&delegate); |
| 54 | 57 |
| 55 BlimpContents* attached_blimp_contents = nullptr; | 58 BlimpContents* attached_blimp_contents = nullptr; |
| 56 | 59 |
| 57 EXPECT_CALL(delegate, AttachBlimpContentsHelpers(testing::_)) | 60 EXPECT_CALL(delegate, AttachBlimpContentsHelpers(testing::_)) |
| 58 .WillOnce(testing::SaveArg<0>(&attached_blimp_contents)) | 61 .WillOnce(testing::SaveArg<0>(&attached_blimp_contents)) |
| 59 .RetiresOnSaturation(); | 62 .RetiresOnSaturation(); |
| 60 | 63 |
| 61 std::unique_ptr<BlimpContents> blimp_contents = | 64 std::unique_ptr<BlimpContents> blimp_contents = |
| 62 blimp_client_context.CreateBlimpContents(); | 65 blimp_client_context.CreateBlimpContents(); |
| 63 DCHECK(blimp_contents); | 66 DCHECK(blimp_contents); |
| 64 DCHECK_EQ(blimp_contents.get(), attached_blimp_contents); | 67 DCHECK_EQ(blimp_contents.get(), attached_blimp_contents); |
| 65 } | 68 } |
| 66 | 69 |
| 67 } // namespace | 70 } // namespace |
| 68 } // namespace client | 71 } // namespace client |
| 69 } // namespace blimp | 72 } // namespace blimp |
| OLD | NEW |