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/engine/common/blimp_browser_context.h" | 5 #include "blimp/engine/common/blimp_browser_context.h" |
| 6 | 6 |
| 7 #include "base/metrics/user_metrics.h" | 7 #include "base/metrics/user_metrics.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "components/metrics/metrics_service.h" | 9 #include "components/metrics/metrics_service.h" |
| 10 #include "content/public/browser/notification_service.h" | |
| 10 #include "content/public/test/test_browser_thread_bundle.h" | 11 #include "content/public/test/test_browser_thread_bundle.h" |
| 11 #include "net/log/net_log.h" | 12 #include "net/log/net_log.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 namespace blimp { | 15 namespace blimp { |
| 15 namespace engine { | 16 namespace engine { |
| 16 | 17 |
| 17 class BlimpBrowserContextTest : public testing::Test { | 18 class BlimpBrowserContextTest : public testing::Test { |
| 18 public: | 19 public: |
| 19 BlimpBrowserContextTest() {} | 20 BlimpBrowserContextTest() {} |
| 20 | 21 |
| 21 protected: | 22 protected: |
| 22 void SetUp() override { | 23 void SetUp() override { |
| 24 // Set up NotificationService | |
|
Wez
2016/06/10 23:50:10
nit: Punctuation at end of line, and clarify _why_
xyzzyz
2016/06/17 20:16:58
Done.
| |
| 25 notification_service_.reset(content::NotificationService::Create()); | |
| 26 | |
| 23 base::SetRecordActionTaskRunner(base::ThreadTaskRunnerHandle::Get()); | 27 base::SetRecordActionTaskRunner(base::ThreadTaskRunnerHandle::Get()); |
| 28 | |
| 24 // Create BlimpBrowserContext. | 29 // Create BlimpBrowserContext. |
| 25 browser_context_.reset(new BlimpBrowserContext(false /* off_the_record */, | 30 browser_context_.reset(new BlimpBrowserContext(false /* off_the_record */, |
| 26 &net_log_)); | 31 &net_log_)); |
| 27 } | 32 } |
| 28 | 33 |
| 29 void TearDown() override { | 34 void TearDown() override { |
| 30 // Clears static variable in MetricsService | 35 // Clears static variable in MetricsService |
| 31 metrics::MetricsService::SetExecutionPhase( | 36 metrics::MetricsService::SetExecutionPhase( |
| 32 metrics::MetricsService::UNINITIALIZED_PHASE, | 37 metrics::MetricsService::UNINITIALIZED_PHASE, |
| 33 browser_context_->GetPrefService()); | 38 browser_context_->GetPrefService()); |
| 34 } | 39 } |
| 35 | 40 |
| 36 private: | 41 private: |
| 37 content::TestBrowserThreadBundle thread_bundle_; | 42 content::TestBrowserThreadBundle thread_bundle_; |
| 43 std::unique_ptr<content::NotificationService> notification_service_; | |
| 38 net::NetLog net_log_; | 44 net::NetLog net_log_; |
| 39 std::unique_ptr<BlimpBrowserContext> browser_context_; | 45 std::unique_ptr<BlimpBrowserContext> browser_context_; |
| 40 | 46 |
| 41 DISALLOW_COPY_AND_ASSIGN(BlimpBrowserContextTest); | 47 DISALLOW_COPY_AND_ASSIGN(BlimpBrowserContextTest); |
| 42 }; | 48 }; |
| 43 | 49 |
| 44 TEST_F(BlimpBrowserContextTest, CtorDtor) { | 50 TEST_F(BlimpBrowserContextTest, CtorDtor) { |
| 45 // Covers construction and destruction of BlimpBrowserContext and | 51 // Covers construction and destruction of BlimpBrowserContext and |
| 46 // associated metrics setup and teardown. | 52 // associated metrics setup and teardown. |
| 47 } | 53 } |
| 48 | 54 |
| 49 } // namespace engine | 55 } // namespace engine |
| 50 } // namespace blimp | 56 } // namespace blimp |
| OLD | NEW |