Index: blimp/client/core/blimp_client_context_impl_unittest.cc |
diff --git a/blimp/client/core/blimp_client_context_impl_unittest.cc b/blimp/client/core/blimp_client_context_impl_unittest.cc |
index e37dee7241e7fe84ae843e63c06112541b576964..1b2c3fcf67f902328ee04cfc80fa870fb46b9e74 100644 |
--- a/blimp/client/core/blimp_client_context_impl_unittest.cc |
+++ b/blimp/client/core/blimp_client_context_impl_unittest.cc |
@@ -4,9 +4,12 @@ |
#include "blimp/client/core/blimp_client_context_impl.h" |
+#include "base/message_loop/message_loop.h" |
+#include "base/threading/thread.h" |
#include "blimp/client/public/blimp_client_context_delegate.h" |
#include "blimp/client/public/contents/blimp_contents.h" |
#include "blimp/client/test/test_blimp_client_context_delegate.h" |
+#include "testing/gmock/include/gmock/gmock.h" |
#include "testing/gtest/include/gtest/gtest.h" |
namespace blimp { |
@@ -14,15 +17,28 @@ namespace client { |
namespace { |
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
|
- BlimpClientContextImpl blimp_client_context; |
+ base::MessageLoop message_loop; |
+ |
+ // Start IO thread. |
+ base::Thread io_thread("BlimpTestIO"); |
+ base::Thread::Options options; |
+ options.message_loop_type = base::MessageLoop::TYPE_IO; |
+ io_thread.StartWithOptions(options); |
+ |
+ BlimpClientContextImpl blimp_client_context(io_thread.task_runner()); |
TestBlimpClientContextDelegate delegate; |
blimp_client_context.SetDelegate(&delegate); |
+ BlimpContents* attached_blimp_contents = nullptr; |
+ |
+ EXPECT_CALL(delegate, AttachBlimpContentsHelpers(testing::_)) |
+ .WillOnce(testing::SaveArg<0>(&attached_blimp_contents)) |
+ .RetiresOnSaturation(); |
+ |
std::unique_ptr<BlimpContents> blimp_contents = |
blimp_client_context.CreateBlimpContents(); |
DCHECK(blimp_contents); |
- DCHECK_EQ(blimp_contents.get(), |
- delegate.GetBlimpContentsWithLastAttachedHelpers()); |
+ DCHECK_EQ(blimp_contents.get(), attached_blimp_contents); |
} |
} // namespace |