diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 10:26:31 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-07 10:26:31 +0000 |
commit | b9a622b9fe09868974a5af845bc474752b239566 (patch) | |
tree | 939d1e3947e35bbd960a925992bc7f049fe5775f /chrome/browser/extensions/test_extension_loader.cc | |
parent | 72cbd32707a2ede460bcc1b3cb199e653282a8ed (diff) | |
download | chromium_src-b9a622b9fe09868974a5af845bc474752b239566.zip chromium_src-b9a622b9fe09868974a5af845bc474752b239566.tar.gz chromium_src-b9a622b9fe09868974a5af845bc474752b239566.tar.bz2 |
Revert "Implement chromium.self in content scripts..."
This reverts commit 61ab30f52667e739602ab2af4fd8f2d8a0a2a2f0.
Still seeing memory errors.
Review URL: http://codereview.chromium.org/63056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13243 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/test_extension_loader.cc')
-rwxr-xr-x | chrome/browser/extensions/test_extension_loader.cc | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/chrome/browser/extensions/test_extension_loader.cc b/chrome/browser/extensions/test_extension_loader.cc deleted file mode 100755 index d8bacb7..0000000 --- a/chrome/browser/extensions/test_extension_loader.cc +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2009 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 "chrome/browser/extensions/test_extension_loader.h" - -#include "base/file_path.h" -#include "base/message_loop.h" -#include "chrome/browser/profile.h" -#include "chrome/browser/extensions/extensions_service.h" -#include "chrome/common/notification_service.h" -#include "chrome/test/ui_test_utils.h" - -namespace { - -// How long to wait for the extension to load before giving up. -const int kLoadTimeoutMs = 5000; - -} // namespace - -TestExtensionLoader::TestExtensionLoader(Profile* profile) - : profile_(profile), - extension_(NULL) { - registrar_.Add(this, NotificationType::EXTENSIONS_LOADED, - NotificationService::AllSources()); - - profile_->GetExtensionsService()->Init(); - DCHECK(profile_->GetExtensionsService()->extensions()->empty()); -} - -Extension* TestExtensionLoader::Load(const char* extension_id, - const FilePath& path) { - loading_extension_id_ = extension_id; - - // Load the extension. - profile_->GetExtensionsService()->LoadExtension(path); - - // Wait for the load to complete. Stick a QuitTask into the message loop - // with the timeout so it will exit if the extension never loads. - extension_ = NULL; - MessageLoop::current()->PostDelayedTask(FROM_HERE, - new MessageLoop::QuitTask, kLoadTimeoutMs); - ui_test_utils::RunMessageLoop(); - - return extension_; -} - -void TestExtensionLoader::Observe(NotificationType type, - const NotificationSource& source, - const NotificationDetails& details) { - if (type == NotificationType::EXTENSIONS_LOADED) { - ExtensionList* extensions = Details<ExtensionList>(details).ptr(); - for (size_t i = 0; i < (*extensions).size(); ++i) { - if ((*extensions)[i]->id() == loading_extension_id_) { - extension_ = (*extensions)[i]; - MessageLoopForUI::current()->Quit(); - break; - } - } - } else { - NOTREACHED(); - } -} |