Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / extensions / browser / extensions_test.h
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.
4
5 #ifndef EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_
6 #define EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace content {
14 class ContentClient;
15 class ContentBrowserClient;
16 class TestBrowserContext;
17 }
18
19 namespace extensions {
20 class TestExtensionsBrowserClient;
21
22 // Base class for extensions module unit tests of browser process code. Sets up
23 // the content module and extensions module client interfaces. Initializes
24 // services for a browser context.
25 //
26 // NOTE: Use this class only in extensions_unittests, not in Chrome unit_tests.
27 // BrowserContextKeyedServiceFactory singletons persist between tests.
28 // In Chrome those factories assume any BrowserContext is a Profile and will
29 // cause crashes if it is not. http://crbug.com/395820
30 class ExtensionsTest : public testing::Test {
31  public:
32   ExtensionsTest();
33   virtual ~ExtensionsTest();
34
35   content::TestBrowserContext* browser_context() {
36     return browser_context_.get();
37   }
38   TestExtensionsBrowserClient* extensions_browser_client() {
39     return extensions_browser_client_.get();
40   }
41
42   // testing::Test overrides:
43   virtual void SetUp() OVERRIDE;
44   virtual void TearDown() OVERRIDE;
45
46  private:
47   scoped_ptr<content::ContentClient> content_client_;
48   scoped_ptr<content::ContentBrowserClient> content_browser_client_;
49   scoped_ptr<content::TestBrowserContext> browser_context_;
50   scoped_ptr<TestExtensionsBrowserClient> extensions_browser_client_;
51
52   DISALLOW_COPY_AND_ASSIGN(ExtensionsTest);
53 };
54
55 }  // namespace extensions
56
57 #endif  // EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_