Chromium Code Reviews| 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/message_loop/message_loop.h" | |
| 8 #include "base/threading/thread.h" | |
| 7 #include "blimp/client/public/blimp_client_context_delegate.h" | 9 #include "blimp/client/public/blimp_client_context_delegate.h" |
| 8 #include "blimp/client/public/contents/blimp_contents.h" | 10 #include "blimp/client/public/contents/blimp_contents.h" |
| 9 #include "blimp/client/test/test_blimp_client_context_delegate.h" | 11 #include "blimp/client/test/test_blimp_client_context_delegate.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 14 |
| 12 namespace blimp { | 15 namespace blimp { |
| 13 namespace client { | 16 namespace client { |
| 14 namespace { | 17 namespace { |
| 15 | 18 |
| 16 TEST(BlimpClientContextImpl, CreatedBlimpContentsGetsHelpersAttached) { | 19 TEST(BlimpClientContextImpl, CreatedBlimpContentsGetsHelpersAttached) { |
|
Kevin M
2016/08/02 19:55:41
Strongly prefer using TEST_F, even if the class bo
nyquist
2016/08/02 21:47:04
In this CL https://codereview.chromium.org/1912153
| |
| 17 BlimpClientContextImpl blimp_client_context; | 20 base::MessageLoop message_loop; |
| 21 | |
| 22 // Start IO thread. | |
| 23 base::Thread io_thread("BlimpTestIO"); | |
| 24 base::Thread::Options options; | |
| 25 options.message_loop_type = base::MessageLoop::TYPE_IO; | |
| 26 io_thread.StartWithOptions(options); | |
| 27 | |
| 28 BlimpClientContextImpl blimp_client_context(io_thread.task_runner()); | |
| 18 TestBlimpClientContextDelegate delegate; | 29 TestBlimpClientContextDelegate delegate; |
| 19 blimp_client_context.SetDelegate(&delegate); | 30 blimp_client_context.SetDelegate(&delegate); |
| 20 | 31 |
| 32 BlimpContents* attached_blimp_contents = nullptr; | |
| 33 | |
| 34 EXPECT_CALL(delegate, AttachBlimpContentsHelpers(testing::_)) | |
| 35 .WillOnce(testing::SaveArg<0>(&attached_blimp_contents)) | |
| 36 .RetiresOnSaturation(); | |
| 37 | |
| 21 std::unique_ptr<BlimpContents> blimp_contents = | 38 std::unique_ptr<BlimpContents> blimp_contents = |
| 22 blimp_client_context.CreateBlimpContents(); | 39 blimp_client_context.CreateBlimpContents(); |
| 23 DCHECK(blimp_contents); | 40 DCHECK(blimp_contents); |
| 24 DCHECK_EQ(blimp_contents.get(), | 41 DCHECK_EQ(blimp_contents.get(), attached_blimp_contents); |
| 25 delegate.GetBlimpContentsWithLastAttachedHelpers()); | |
| 26 } | 42 } |
| 27 | 43 |
| 28 } // namespace | 44 } // namespace |
| 29 } // namespace client | 45 } // namespace client |
| 30 } // namespace blimp | 46 } // namespace blimp |
| OLD | NEW |