summaryrefslogtreecommitdiffstats
path: root/chrome/browser/plugin_test.cc
diff options
context:
space:
mode:
authorbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 18:50:06 +0000
committerbauerb@chromium.org <bauerb@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-13 18:50:06 +0000
commit725f688c5d44e0a3d02e8a0f87ee5fef9e328eb1 (patch)
tree7bbf267f3c5259bbe7caa3dda99b00821d239b5f /chrome/browser/plugin_test.cc
parent25888eae643f3e6ba01b694f75769e52ae8f9bff (diff)
downloadchromium_src-725f688c5d44e0a3d02e8a0f87ee5fef9e328eb1.zip
chromium_src-725f688c5d44e0a3d02e8a0f87ee5fef9e328eb1.tar.gz
chromium_src-725f688c5d44e0a3d02e8a0f87ee5fef9e328eb1.tar.bz2
Reland 117210 - Show error message when download a plug-in installer fails.
Also, don't try to directly download Flash Player from http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player.exe anymore. Original review URL: http://codereview.chromium.org/9149004 TBR=arv@chromium.org BUG=102987 TEST=Go to http://www/~bauerb/no_crawl/test/install_plugin.html, turn off your network and click on "Get Plug-in". You should see an error. Review URL: http://codereview.chromium.org/9148024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117661 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/plugin_test.cc')
-rw-r--r--chrome/browser/plugin_test.cc100
1 files changed, 0 insertions, 100 deletions
diff --git a/chrome/browser/plugin_test.cc b/chrome/browser/plugin_test.cc
index 711ef0d..d4639e1 100644
--- a/chrome/browser/plugin_test.cc
+++ b/chrome/browser/plugin_test.cc
@@ -27,9 +27,7 @@
#include <string>
-#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/test/test_timeouts.h"
#include "chrome/browser/plugin_download_helper.h"
@@ -40,10 +38,7 @@
#include "chrome/test/base/ui_test_utils.h"
#include "chrome/test/ui/ui_test.h"
#include "content/browser/net/url_request_mock_http_job.h"
-#include "content/test/test_browser_thread.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"
#include "webkit/plugins/npapi/plugin_list.h"
@@ -251,98 +246,3 @@ TEST_F(PluginTest, Silverlight) {
TestTimeouts::action_max_timeout_ms(), false);
}
#endif // defined(OS_WIN)
-
-#if !defined(OS_CHROMEOS)
-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 : public testing::Test {
- public:
- PluginInstallerDownloadTest()
- : message_loop_(MessageLoop::TYPE_IO),
- file_thread_(content::BrowserThread::FILE, &message_loop_),
- download_helper_(NULL),
- success_(false) {}
- ~PluginInstallerDownloadTest() {}
-
- void Start() {
- initial_download_path_ = PluginTest::GetTestUrl("flash.html", "", false);
- download_helper_ = new PluginDownloadUrlHelper();
- TestURLRequestContextGetter* context_getter =
- new TestURLRequestContextGetter;
- download_helper_->InitiateDownload(
- initial_download_path_,
- context_getter,
- base::Bind(&PluginInstallerDownloadTest::OnDownloadCompleted,
- base::Unretained(this)));
-
- message_loop_.PostDelayedTask(
- FROM_HERE, MessageLoop::QuitClosure(),
- TestTimeouts::action_max_timeout_ms());
- }
-
- void OnDownloadCompleted(const FilePath& download_path) {
- success_ = true;
- final_download_path_ = download_path;
- message_loop_.Quit();
- download_helper_ = NULL;
- }
-
- FilePath final_download_path() const {
- return final_download_path_;
- }
-
- FilePath initial_download_path() const {
- return final_download_path_;
- }
-
- bool success() const {
- return success_;
- }
-
- private:
- MessageLoop message_loop_;
- content::TestBrowserThread file_thread_;
- FilePath final_download_path_;
- PluginDownloadUrlHelper* download_helper_;
- bool success_;
- GURL initial_download_path_;
-};
-
-// This test validates that the plugin downloader downloads the specified file
-// to a temporary path with the same file name.
-TEST_F(PluginInstallerDownloadTest, PluginInstallerDownloadPathTest) {
- Start();
- MessageLoop::current()->Run();
-
- EXPECT_TRUE(success());
- EXPECT_TRUE(initial_download_path().BaseName().value() ==
- final_download_path().BaseName().value());
-}
-#endif // !defined(OS_CHROMEOS)