Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / extensions / browser / extensions_test.h
blobe930421a1e1c7fda437e560af79621c16643a393
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_
6 #define EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "content/public/test/test_renderer_host.h"
12 #include "extensions/browser/mock_extension_system.h"
13 #include "testing/gtest/include/gtest/gtest.h"
15 namespace content {
16 class BrowserContext;
17 class ContentBrowserClient;
18 class ContentClient;
19 class ContentUtilityClient;
20 class RenderViewHostTestEnabler;
23 namespace extensions {
24 class TestExtensionsBrowserClient;
26 // Base class for extensions module unit tests of browser process code. Sets up
27 // the content module and extensions module client interfaces. Initializes
28 // services for a browser context.
30 // NOTE: Use this class only in extensions_unittests, not in Chrome unit_tests.
31 // BrowserContextKeyedServiceFactory singletons persist between tests.
32 // In Chrome those factories assume any BrowserContext is a Profile and will
33 // cause crashes if it is not. http://crbug.com/395820
34 class ExtensionsTest : public testing::Test {
35 public:
36 ExtensionsTest();
37 ~ExtensionsTest() override;
39 // Returned as a BrowserContext since most users don't need methods from
40 // TestBrowserContext.
41 content::BrowserContext* browser_context() { return browser_context_.get(); }
43 // Returned as a TestExtensionsBrowserClient since most users need to call
44 // test-specific methods on it.
45 TestExtensionsBrowserClient* extensions_browser_client() {
46 return extensions_browser_client_.get();
49 // testing::Test overrides:
50 void SetUp() override;
51 void TearDown() override;
53 private:
54 // TODO(yoz): Add a NotificationService here; it's used widely enough.
55 scoped_ptr<content::ContentClient> content_client_;
56 scoped_ptr<content::ContentUtilityClient> content_utility_client_;
57 scoped_ptr<content::ContentBrowserClient> content_browser_client_;
58 scoped_ptr<content::BrowserContext> browser_context_;
59 scoped_ptr<TestExtensionsBrowserClient> extensions_browser_client_;
61 // The existence of this object enables tests via
62 // RenderViewHostTester.
63 content::RenderViewHostTestEnabler rvh_test_enabler_;
65 MockExtensionSystemFactory<MockExtensionSystem> extension_system_factory_;
67 DISALLOW_COPY_AND_ASSIGN(ExtensionsTest);
70 } // namespace extensions
72 #endif // EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_