Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(531)

Side by Side Diff: extensions/browser/extensions_test.h

Issue 554963002: Move extensions power API unit test to extensions_unittests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « extensions/browser/api_test_utils.cc ('k') | extensions/extensions.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #ifndef EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_ 5 #ifndef EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_
6 #define EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_ 6 #define EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
12 12
13 namespace content { 13 namespace content {
14 class BrowserContext;
14 class ContentClient; 15 class ContentClient;
15 class ContentBrowserClient; 16 class ContentBrowserClient;
16 class TestBrowserContext;
17 } 17 }
18 18
19 namespace extensions { 19 namespace extensions {
20 class TestExtensionsBrowserClient; 20 class TestExtensionsBrowserClient;
21 21
22 // Base class for extensions module unit tests of browser process code. Sets up 22 // Base class for extensions module unit tests of browser process code. Sets up
23 // the content module and extensions module client interfaces. Initializes 23 // the content module and extensions module client interfaces. Initializes
24 // services for a browser context. 24 // services for a browser context.
25 // 25 //
26 // NOTE: Use this class only in extensions_unittests, not in Chrome unit_tests. 26 // NOTE: Use this class only in extensions_unittests, not in Chrome unit_tests.
27 // BrowserContextKeyedServiceFactory singletons persist between tests. 27 // BrowserContextKeyedServiceFactory singletons persist between tests.
28 // In Chrome those factories assume any BrowserContext is a Profile and will 28 // In Chrome those factories assume any BrowserContext is a Profile and will
29 // cause crashes if it is not. http://crbug.com/395820 29 // cause crashes if it is not. http://crbug.com/395820
30 class ExtensionsTest : public testing::Test { 30 class ExtensionsTest : public testing::Test {
31 public: 31 public:
32 ExtensionsTest(); 32 ExtensionsTest();
33 virtual ~ExtensionsTest(); 33 virtual ~ExtensionsTest();
34 34
35 content::TestBrowserContext* browser_context() { 35 // Returned as a BrowserContext since most users don't need methods from
James Cook 2014/09/09 00:05:39 I've found as I moved tests around that I frequent
Yoyo Zhou 2014/09/09 00:43:40 vs. extensions_browser_client, you mean? Yes, I ag
36 return browser_context_.get(); 36 // TestBrowserContext.
37 } 37 content::BrowserContext* browser_context() { return browser_context_.get(); }
38
39 // Returned as a TestExtensionsBrowserClient since most users need to call
40 // test-specific methods on it.
38 TestExtensionsBrowserClient* extensions_browser_client() { 41 TestExtensionsBrowserClient* extensions_browser_client() {
39 return extensions_browser_client_.get(); 42 return extensions_browser_client_.get();
40 } 43 }
41 44
42 // testing::Test overrides: 45 // testing::Test overrides:
43 virtual void SetUp() OVERRIDE; 46 virtual void SetUp() OVERRIDE;
44 virtual void TearDown() OVERRIDE; 47 virtual void TearDown() OVERRIDE;
45 48
46 private: 49 private:
47 scoped_ptr<content::ContentClient> content_client_; 50 scoped_ptr<content::ContentClient> content_client_;
48 scoped_ptr<content::ContentBrowserClient> content_browser_client_; 51 scoped_ptr<content::ContentBrowserClient> content_browser_client_;
49 scoped_ptr<content::TestBrowserContext> browser_context_; 52 scoped_ptr<content::BrowserContext> browser_context_;
50 scoped_ptr<TestExtensionsBrowserClient> extensions_browser_client_; 53 scoped_ptr<TestExtensionsBrowserClient> extensions_browser_client_;
51 54
52 DISALLOW_COPY_AND_ASSIGN(ExtensionsTest); 55 DISALLOW_COPY_AND_ASSIGN(ExtensionsTest);
53 }; 56 };
54 57
55 } // namespace extensions 58 } // namespace extensions
56 59
57 #endif // EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_ 60 #endif // EXTENSIONS_BROWSER_EXTENSIONS_TEST_H_
OLDNEW
« no previous file with comments | « extensions/browser/api_test_utils.cc ('k') | extensions/extensions.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698