Chromium Code Reviews| Index: blimp/engine/common/blimp_browser_context_unittest.cc |
| diff --git a/blimp/engine/common/blimp_browser_context_unittest.cc b/blimp/engine/common/blimp_browser_context_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ae9a6bd357a4bc45d1dbf8da2d07f9fdaa086413 |
| --- /dev/null |
| +++ b/blimp/engine/common/blimp_browser_context_unittest.cc |
| @@ -0,0 +1,49 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "blimp/engine/common/blimp_browser_context.h" |
| + |
| +#include "base/message_loop/message_loop.h" |
| +#include "base/metrics/user_metrics.h" |
| +#include "base/run_loop.h" |
| +#include "components/metrics/metrics_service.h" |
| +#include "content/public/test/test_browser_thread_bundle.h" |
| +#include "net/log/net_log.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace blimp { |
| +namespace engine { |
| + |
| +class BlimpBrowserContextTest : public testing::Test { |
| + protected: |
|
Alexei Svitkine (slow)
2016/05/10 17:38:07
Nit: Begin with a public section. Probably fine to
Jess
2016/05/10 18:23:49
Created a public section for the default construct
|
| + void SetUp() override; |
| + void TearDown() override; |
| + private: |
|
Alexei Svitkine (slow)
2016/05/10 17:38:07
Nit: Empty line above this.
Jess
2016/05/10 18:23:49
Done.
|
| + content::TestBrowserThreadBundle thread_bundle_; |
| + net::NetLog net_log_; |
| + std::unique_ptr<BlimpBrowserContext> browser_context_; |
| +}; |
|
Alexei Svitkine (slow)
2016/05/10 17:38:07
Nit: DISALLOW_COPY_AND_ASSIGN().
Jess
2016/05/10 18:23:49
Done.
|
| + |
| +void BlimpBrowserContextTest::SetUp() { |
|
Alexei Svitkine (slow)
2016/05/10 17:38:07
Nit: You can probably declare these inline.
Jess
2016/05/10 18:23:49
Done.
|
| + base::SetRecordActionTaskRunner( |
| + base::MessageLoop::current()->task_runner()); |
| + // Create BlimpBrowserContext. |
| + browser_context_.reset(new BlimpBrowserContext(false /* off_the_record */, |
| + &net_log_)); |
| +} |
| + |
| +void BlimpBrowserContextTest::TearDown() { |
| + // Clears static variable in MetricsService |
| + metrics::MetricsService::SetExecutionPhase( |
| + metrics::MetricsService::UNINITIALIZED_PHASE, |
| + browser_context_->GetPrefService()); |
| +} |
| + |
| +TEST_F(BlimpBrowserContextTest, CtorDtor) { |
| + // Covers construction and destruction of BlimpBrowserContext and |
| + // associated metrics setup and teardown. |
| +} |
| + |
| +} // namespace engine |
| +} // namespace blimp |