Revert of Add ExtensionsTestBrowserContext class for test....

Revert of Add ExtensionsTestBrowserContext class for test. (https://codereview.chromium.org/355223002/)

Reason for revert:
This is breaking the Chrome OS valgrind bots:

http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20OS%20(valgrind)(5)

For example:

http://build.chromium.org/p/chromium.memory.fyi/builders/Chromium%20OS%20%28valgrind%29%285%29/builds/28278

This is a problem with mixing tests that use TestingProfile and TestBrowserContext.  See crbug.com/395820

Original issue's description:
> Add ExtensionsTestBrowserContext class for test.
> and Use ExtensionTestBrowserContext for ImageLoader unittest.
> 
> ExtensionsTestBrowserContext class does 
> set TestExtensionsBrowserClient from constructor and
> call DestroyBrowserContextServices from destructor.
> 
> ExtensionTestBrowserContext will be used instead of TestingProfile.
> 
> R=yoz@chromium.org, rdevlin@chromium.org
> BUG=354046
> TEST=unit_tests --gtest_filter=ImageLoaderTest.DeleteExtensionWhileWaitingForCache
> 
> Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=284330

TBR=jamescook@chromium.org
NOTRY=true

Review URL: https://codereview.chromium.org/406093004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284567 0039d316-1c4b-4281-b951-d872f2087c98
parent 6b34a1ed
......@@ -32,7 +32,6 @@
'../components/components.gyp:sync_driver_test_support',
'../content/content.gyp:content_app_both',
'../content/content_shell_and_tests.gyp:test_support_content',
'../extensions/extensions.gyp:extensions_test_support',
'../net/net.gyp:net',
'../net/net.gyp:net_test_support',
'../skia/skia.gyp:skia',
......
// Copyright 2014 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 "extensions/browser/extensions_test_browser_context.h"
#include "components/keyed_service/content/browser_context_dependency_manager.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/test_extensions_browser_client.h"
namespace extensions {
ExtensionsTestBrowserContext::ExtensionsTestBrowserContext() :
extensions_browser_client_(this) {
BrowserContextDependencyManager::GetInstance()
->CreateBrowserContextServicesForTest(this);
ExtensionsBrowserClient::Set(&extensions_browser_client_);
}
ExtensionsTestBrowserContext::~ExtensionsTestBrowserContext() {
BrowserContextDependencyManager::GetInstance()
->DestroyBrowserContextServices(this);
ExtensionsBrowserClient::Set(NULL);
}
} // namespace extensions
// Copyright 2014 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.
#ifndef EXTENSIONS_COMMON_EXTENSIONS_TEST_BROWSER_CONTEXT_H_
#define EXTENSIONS_COMMON_EXTENSIONS_TEST_BROWSER_CONTEXT_H_
#include "content/public/test/test_browser_context.h"
#include "extensions/browser/test_extensions_browser_client.h"
namespace extensions {
// An implementation of BrowserContext used for extension testing. It will set
// necessary extension state like the ExtensionsBrowserClient and any keyed
// services, and cleans up after itself on destruction.
class ExtensionsTestBrowserContext : public content::TestBrowserContext {
public:
ExtensionsTestBrowserContext();
virtual ~ExtensionsTestBrowserContext();
private:
TestExtensionsBrowserClient extensions_browser_client_;
DISALLOW_COPY_AND_ASSIGN(ExtensionsTestBrowserContext);
};
} // namespace extensions
#endif // EXTENSIONS_COMMON_EXTENSIONS_TEST_BROWSER_CONTEXT_H_
......@@ -9,12 +9,12 @@
#include "base/message_loop/message_loop.h"
#include "base/path_service.h"
#include "base/strings/string_util.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "content/public/browser/notification_service.h"
#include "content/public/test/test_browser_thread.h"
#include "extensions/browser/component_extension_resource_manager.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/extensions_test_browser_context.h"
#include "extensions/common/constants.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_icon_set.h"
......@@ -185,10 +185,13 @@ TEST_F(ImageLoaderTest, DeleteExtensionWhileWaitingForCache) {
// The image isn't cached, so we should not have received notification.
EXPECT_EQ(0, image_loaded_count());
extensions::ExtensionsTestBrowserContext browser_context;
// Send out notification the extension was uninstalled.
extensions::ExtensionRegistry::Get(&browser_context)->TriggerOnUnloaded(
extension.get(), UnloadedExtensionInfo::REASON_UNINSTALL);
UnloadedExtensionInfo details(extension.get(),
UnloadedExtensionInfo::REASON_UNINSTALL);
content::NotificationService::current()->Notify(
chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
content::NotificationService::AllSources(),
content::Details<UnloadedExtensionInfo>(&details));
// Chuck the extension, that way if anyone tries to access it we should crash
// or get valgrind errors.
......
......@@ -661,8 +661,6 @@
'<(SHARED_INTERMEDIATE_DIR)',
],
'sources': [
'browser/extensions_test_browser_context.cc',
'browser/extensions_test_browser_context.h',
'browser/test_extensions_browser_client.cc',
'browser/test_extensions_browser_client.h',
'browser/test_management_policy.cc',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment