Chromium Code Reviews| Index: chrome/browser/android/offline_pages/request_coordinator_factory_unittest.cc |
| diff --git a/chrome/browser/android/offline_pages/request_coordinator_factory_unittest.cc b/chrome/browser/android/offline_pages/request_coordinator_factory_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..b5b88033ea4febc7871c2e2201157ce8326c0d7f |
| --- /dev/null |
| +++ b/chrome/browser/android/offline_pages/request_coordinator_factory_unittest.cc |
| @@ -0,0 +1,44 @@ |
| +// 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 "chrome/browser/android/offline_pages/request_coordinator_factory.h" |
| + |
| +#include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| +#include "components/offline_pages/background/request_coordinator.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace offline_pages { |
| + |
| +class RequestCoordinatorFactoryTest : public ChromeRenderViewHostTestHarness { |
| + public: |
| + RequestCoordinatorFactoryTest(); |
| + ~RequestCoordinatorFactoryTest() override; |
| + |
| + void SetUp() override; |
| +}; |
| + |
| +RequestCoordinatorFactoryTest::RequestCoordinatorFactoryTest() {} |
| + |
| +RequestCoordinatorFactoryTest::~RequestCoordinatorFactoryTest() {} |
| + |
| +void RequestCoordinatorFactoryTest::SetUp() { |
| + content::RenderViewHostTestHarness::SetUp(); |
|
fgorski
2016/05/11 19:45:15
About removal of setup.
This is exactly what I imp
Pete Williamson
2016/05/11 22:13:03
Done.
|
| +} |
| + |
| +TEST_F(RequestCoordinatorFactoryTest, BuildRequestCoordinator) { |
| + RequestCoordinatorFactory* factory = RequestCoordinatorFactory::GetInstance(); |
| + EXPECT_NE(nullptr, factory); |
| + RequestCoordinator* coordinator1 = |
| + factory->GetForBrowserContext(browser_context()); |
|
fgorski
2016/05/11 19:45:15
Nice. I missed that.
Pete Williamson
2016/05/11 22:13:03
Acknowledged.
|
| + // We should actually get a coordinator. |
| + EXPECT_NE(nullptr, coordinator1); |
| + |
| + RequestCoordinator* coordinator2 = |
| + factory->GetForBrowserContext(browser_context()); |
| + // Calling twice gives us the same coordinator. |
| + EXPECT_EQ(coordinator1, coordinator2); |
| + |
| +} |
| + |
| +} // namespace offline_pages |