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

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

Issue 2785373003: Mark content::TestBrowserContext as live in ExtensionsTest before use. (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | no next file » | 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 #include "extensions/browser/extensions_test.h" 5 #include "extensions/browser/extensions_test.h"
6 6
7 #include "components/keyed_service/content/browser_context_dependency_manager.h" 7 #include "components/keyed_service/content/browser_context_dependency_manager.h"
8 #include "content/public/browser/content_browser_client.h" 8 #include "content/public/browser/content_browser_client.h"
9 #include "content/public/common/content_client.h" 9 #include "content/public/common/content_client.h"
10 #include "content/public/test/test_browser_context.h" 10 #include "content/public/test/test_browser_context.h"
(...skipping 10 matching lines...) Expand all
21 // MyExtensionsTest() 21 // MyExtensionsTest()
22 // : my_object_(browser_context())) { 22 // : my_object_(browser_context())) {
23 // } 23 // }
24 // }; 24 // };
25 ExtensionsTest::ExtensionsTest() 25 ExtensionsTest::ExtensionsTest()
26 : content_browser_client_(new TestContentBrowserClient), 26 : content_browser_client_(new TestContentBrowserClient),
27 content_utility_client_(new TestContentUtilityClient), 27 content_utility_client_(new TestContentUtilityClient),
28 browser_context_(new content::TestBrowserContext), 28 browser_context_(new content::TestBrowserContext),
29 extensions_browser_client_( 29 extensions_browser_client_(
30 new TestExtensionsBrowserClient(browser_context_.get())) { 30 new TestExtensionsBrowserClient(browser_context_.get())) {
31 BrowserContextDependencyManager::GetInstance()->MarkBrowserContextLive(
32 browser_context_.get());
31 content::SetBrowserClientForTesting(content_browser_client_.get()); 33 content::SetBrowserClientForTesting(content_browser_client_.get());
32 content::SetUtilityClientForTesting(content_utility_client_.get()); 34 content::SetUtilityClientForTesting(content_utility_client_.get());
33 ExtensionsBrowserClient::Set(extensions_browser_client_.get()); 35 ExtensionsBrowserClient::Set(extensions_browser_client_.get());
34 extensions_browser_client_->set_extension_system_factory( 36 extensions_browser_client_->set_extension_system_factory(
35 &extension_system_factory_); 37 &extension_system_factory_);
36 } 38 }
37 39
38 ExtensionsTest::~ExtensionsTest() { 40 ExtensionsTest::~ExtensionsTest() {
39 ExtensionsBrowserClient::Set(nullptr); 41 ExtensionsBrowserClient::Set(nullptr);
40 content::SetBrowserClientForTesting(nullptr); 42 content::SetBrowserClientForTesting(nullptr);
(...skipping 10 matching lines...) Expand all
51 // Allows individual tests to have BrowserContextKeyedServiceFactory objects 53 // Allows individual tests to have BrowserContextKeyedServiceFactory objects
52 // as member variables instead of singletons. The individual services will be 54 // as member variables instead of singletons. The individual services will be
53 // cleaned up before the factories are destroyed. 55 // cleaned up before the factories are destroyed.
54 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices( 56 BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(
55 browser_context_.get()); 57 browser_context_.get());
56 extensions_browser_client_.reset(); 58 extensions_browser_client_.reset();
57 browser_context_.reset(); 59 browser_context_.reset();
58 } 60 }
59 61
60 } // namespace extensions 62 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698