summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_test.cc
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 22:31:56 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-18 22:31:56 +0000
commitb2862f008ae2032b3b44e0ef9999dd589059b227 (patch)
tree917027a5db0c51311b8c7994e5e893d9d82d1794 /chrome/browser/plugin_test.cc
parentdceb0b66356caee49724006936803ad5cb09cb0f (diff)
downloadchromium_src-b2862f008ae2032b3b44e0ef9999dd589059b227.zip
chromium_src-b2862f008ae2032b3b44e0ef9999dd589059b227.tar.gz
chromium_src-b2862f008ae2032b3b44e0ef9999dd589059b227.tar.bz2
Fix a thread restriction ASSERTION in the plugin download helper class which occurs while handling a url
download request from the default plugin. The ASSERTION fires because we attempt to perform file IO on the IO thread. Fix is to issue the download request on the file thread. Switched to using the URLFetcher class for the download request as it internally proxies the actual HTTP requests to the IO thread. Fixes bug http://code.google.com/p/chromium/issues/detail?id=93186 BUG=93186 Review URL: http://codereview.chromium.org/7670038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_test.cc')
-rw-r--r--chrome/browser/plugin_test.cc32
1 files changed, 31 insertions, 1 deletions
diff --git a/chrome/browser/plugin_test.cc b/chrome/browser/plugin_test.cc
index a81dc2f..7909f15 100644
--- a/chrome/browser/plugin_test.cc
+++ b/chrome/browser/plugin_test.cc
@@ -41,6 +41,7 @@
#include "chrome/test/ui/ui_test.h"
#include "content/browser/net/url_request_mock_http_job.h"
#include "net/base/net_util.h"
+#include "net/url_request/url_request_context_getter.h"
#include "net/url_request/url_request_test_util.h"
#include "third_party/npapi/bindings/npapi.h"
#include "webkit/plugins/npapi/plugin_constants_win.h"
@@ -249,6 +250,32 @@ TEST_F(PluginTest, Silverlight) {
TestTimeouts::action_max_timeout_ms(), false);
}
+namespace {
+
+class TestURLRequestContextGetter : public net::URLRequestContextGetter {
+ public:
+ explicit TestURLRequestContextGetter() {
+ io_message_loop_proxy_ = base::MessageLoopProxy::current();
+ }
+ virtual net::URLRequestContext* GetURLRequestContext() {
+ if (!context_)
+ context_ = new TestURLRequestContext();
+ return context_;
+ }
+ virtual scoped_refptr<base::MessageLoopProxy> GetIOMessageLoopProxy() const {
+ return io_message_loop_proxy_;
+ }
+
+ protected:
+ scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
+
+ private:
+ virtual ~TestURLRequestContextGetter() {}
+
+ scoped_refptr<net::URLRequestContext> context_;
+};
+
+} // namespace
// This class provides functionality to test the plugin installer download
// file functionality.
class PluginInstallerDownloadTest
@@ -265,7 +292,10 @@ class PluginInstallerDownloadTest
download_helper_ = new PluginDownloadUrlHelper(
initial_download_path_.spec(), NULL,
static_cast<PluginDownloadUrlHelper::DownloadDelegate*>(this));
- download_helper_->InitiateDownload(new TestURLRequestContext);
+ TestURLRequestContextGetter* context_getter =
+ new TestURLRequestContextGetter;
+ download_helper_->InitiateDownload(context_getter,
+ context_getter->GetIOMessageLoopProxy());
MessageLoop::current()->PostDelayedTask(
FROM_HERE, new MessageLoop::QuitTask,