Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5020)

Unified Diff: blimp/client/core/blimp_client_context_impl_unittest.cc

Issue 2190753002: Add network setup code to BlimpClientContextImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@split-blimp-client-session
Patch Set: Updated comments and changed test to use a testing::Test class Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « blimp/client/core/blimp_client_context_impl.cc ('k') | blimp/client/core/dummy_blimp_client_context.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..57c768ffd15b8b59b0102803d6acdf70893a4be6 100644
--- a/blimp/client/core/blimp_client_context_impl_unittest.cc
+++ b/blimp/client/core/blimp_client_context_impl_unittest.cc
@@ -4,25 +4,62 @@
#include "blimp/client/core/blimp_client_context_impl.h"
+#include "base/macros.h"
+#include "base/message_loop/message_loop.h"
+#include "base/run_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 {
namespace client {
namespace {
-TEST(BlimpClientContextImpl, CreatedBlimpContentsGetsHelpersAttached) {
- BlimpClientContextImpl blimp_client_context;
+class BlimpClientContextImplTest : public testing::Test {
+ public:
+ BlimpClientContextImplTest() : io_thread_("BlimpTestIO") {}
+ ~BlimpClientContextImplTest() override {}
+
+ void SetUp() override {
+ base::Thread::Options options;
+ options.message_loop_type = base::MessageLoop::TYPE_IO;
+ io_thread_.StartWithOptions(options);
+ }
+
+ void TearDown() override {
+ io_thread_.Stop();
+ base::RunLoop().RunUntilIdle();
+ }
+
+ protected:
+ // The thread to use for IO related tasks.
+ base::Thread io_thread_;
+
+ private:
+ // Message loop for the test thread.
+ base::MessageLoop message_loop_;
+
+ DISALLOW_COPY_AND_ASSIGN(BlimpClientContextImplTest);
+};
+
+TEST_F(BlimpClientContextImplTest, CreatedBlimpContentsGetsHelpersAttached) {
+ 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
« no previous file with comments | « blimp/client/core/blimp_client_context_impl.cc ('k') | blimp/client/core/dummy_blimp_client_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698