| Index: chrome/browser/media/router/discovery/dial/dial_registry_factory_unittest.cc
|
| diff --git a/chrome/browser/media/router/discovery/dial/dial_registry_factory_unittest.cc b/chrome/browser/media/router/discovery/dial/dial_registry_factory_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c26dc4bb5da826583f480538acc04a57a8f6dbcc
|
| --- /dev/null
|
| +++ b/chrome/browser/media/router/discovery/dial/dial_registry_factory_unittest.cc
|
| @@ -0,0 +1,47 @@
|
| +// Copyright 2017 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 <memory>
|
| +
|
| +#include "base/memory/ptr_util.h"
|
| +#include "chrome/browser/media/router/discovery/dial/dial_registry.h"
|
| +#include "chrome/browser/media/router/discovery/dial/dial_registry_factory.h"
|
| +#include "chrome/test/base/testing_profile.h"
|
| +#include "content/public/browser/browser_context.h"
|
| +#include "content/public/test/test_browser_thread_bundle.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +namespace media_router {
|
| +
|
| +class DialRegistryFactoryTest : public testing::Test {
|
| + protected:
|
| + DialRegistryFactoryTest() {}
|
| + ~DialRegistryFactoryTest() override {}
|
| +
|
| + Profile* profile() { return &profile_; }
|
| +
|
| + private:
|
| + content::TestBrowserThreadBundle thread_bundle_;
|
| + TestingProfile profile_;
|
| +};
|
| +
|
| +TEST_F(DialRegistryFactoryTest, CreateForRegularProfile) {
|
| + ASSERT_TRUE(DialRegistryFactory::GetForBrowserContext(profile()));
|
| +}
|
| +
|
| +TEST_F(DialRegistryFactoryTest, CreateForIncognitoProfile) {
|
| + Profile* incognito_profile = profile()->GetOffTheRecordProfile();
|
| + ASSERT_TRUE(incognito_profile);
|
| +
|
| + // Makes sure a DialRegistry can be created from an incognito Profile.
|
| + scoped_refptr<DialRegistry> dial_registry =
|
| + DialRegistryFactory::GetForBrowserContext(incognito_profile);
|
| + ASSERT_TRUE(dial_registry);
|
| +
|
| + // A Profile and its incognito Profile share the same DialRegistry instance.
|
| + ASSERT_EQ(dial_registry,
|
| + DialRegistryFactory::GetForBrowserContext(profile()));
|
| +}
|
| +
|
| +} // namespace media_router
|
|
|