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" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 13 |
| 12 namespace blimp { | 14 namespace blimp { |
| 13 namespace client { | 15 namespace client { |
| 14 namespace { | 16 namespace { |
| 15 | 17 |
| 16 TEST(BlimpClientContextImpl, CreatedBlimpContentsGetsHelpersAttached) { | 18 TEST(BlimpClientContextImpl, CreatedBlimpContentsGetsHelpersAttached) { |
| 17 BlimpClientContextImpl blimp_client_context; | 19 base::MessageLoop message_loop; |
| 20 | |
| 21 // Start IO thread. | |
| 22 base::Thread io_thread("BlimpTestIO"); | |
| 23 base::Thread::Options options; | |
| 24 options.message_loop_type = base::MessageLoop::TYPE_IO; | |
| 25 io_thread.StartWithOptions(options); | |
| 26 | |
| 27 BlimpClientContextImpl blimp_client_context(io_thread.task_runner()); | |
| 18 TestBlimpClientContextDelegate delegate; | 28 TestBlimpClientContextDelegate delegate; |
| 19 blimp_client_context.SetDelegate(&delegate); | 29 blimp_client_context.SetDelegate(&delegate); |
| 20 | 30 |
| 21 std::unique_ptr<BlimpContents> blimp_contents = | 31 std::unique_ptr<BlimpContents> blimp_contents = |
| 22 blimp_client_context.CreateBlimpContents(); | 32 blimp_client_context.CreateBlimpContents(); |
| 23 DCHECK(blimp_contents); | 33 DCHECK(blimp_contents); |
| 24 DCHECK_EQ(blimp_contents.get(), | 34 DCHECK_EQ(blimp_contents.get(), |
| 25 delegate.GetBlimpContentsWithLastAttachedHelpers()); | 35 delegate.GetBlimpContentsWithLastAttachedHelpers()); |
|
Kevin M
2016/07/29 19:23:17
Rather than using a getter and a field for saving
nyquist
2016/07/29 22:26:57
Done.
| |
| 26 } | 36 } |
| 27 | 37 |
| 28 } // namespace | 38 } // namespace |
| 29 } // namespace client | 39 } // namespace client |
| 30 } // namespace blimp | 40 } // namespace blimp |
| OLD | NEW |