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

Side by Side Diff: chrome/browser/download/download_browsertest.cc

Issue 19706002: Remove plugin_list.h includes from chrome tests in preparation for moving webkit/plugins to content… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix posix tests Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/extensions/api/content_settings/content_settings_api.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <sstream> 5 #include <sstream>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 #include "chrome/common/extensions/feature_switch.h" 58 #include "chrome/common/extensions/feature_switch.h"
59 #include "chrome/common/pref_names.h" 59 #include "chrome/common/pref_names.h"
60 #include "chrome/common/url_constants.h" 60 #include "chrome/common/url_constants.h"
61 #include "chrome/test/base/in_process_browser_test.h" 61 #include "chrome/test/base/in_process_browser_test.h"
62 #include "chrome/test/base/ui_test_utils.h" 62 #include "chrome/test/base/ui_test_utils.h"
63 #include "content/public/browser/download_item.h" 63 #include "content/public/browser/download_item.h"
64 #include "content/public/browser/download_manager.h" 64 #include "content/public/browser/download_manager.h"
65 #include "content/public/browser/download_save_info.h" 65 #include "content/public/browser/download_save_info.h"
66 #include "content/public/browser/download_url_parameters.h" 66 #include "content/public/browser/download_url_parameters.h"
67 #include "content/public/browser/notification_source.h" 67 #include "content/public/browser/notification_source.h"
68 #include "content/public/browser/plugin_service.h"
69 #include "content/public/browser/render_view_host.h" 68 #include "content/public/browser/render_view_host.h"
70 #include "content/public/browser/resource_context.h" 69 #include "content/public/browser/resource_context.h"
71 #include "content/public/browser/web_contents.h" 70 #include "content/public/browser/web_contents.h"
72 #include "content/public/common/content_switches.h" 71 #include "content/public/common/content_switches.h"
73 #include "content/public/common/context_menu_params.h" 72 #include "content/public/common/context_menu_params.h"
74 #include "content/public/common/page_transition_types.h" 73 #include "content/public/common/page_transition_types.h"
75 #include "content/public/test/browser_test_utils.h" 74 #include "content/public/test/browser_test_utils.h"
76 #include "content/public/test/download_test_observer.h" 75 #include "content/public/test/download_test_observer.h"
77 #include "content/public/test/test_file_error_injector.h" 76 #include "content/public/test/test_file_error_injector.h"
78 #include "content/public/test/test_navigation_observer.h" 77 #include "content/public/test/test_navigation_observer.h"
79 #include "content/test/net/url_request_mock_http_job.h" 78 #include "content/test/net/url_request_mock_http_job.h"
80 #include "content/test/net/url_request_slow_download_job.h" 79 #include "content/test/net/url_request_slow_download_job.h"
81 #include "grit/generated_resources.h" 80 #include "grit/generated_resources.h"
82 #include "net/base/net_util.h" 81 #include "net/base/net_util.h"
83 #include "net/test/spawned_test_server/spawned_test_server.h" 82 #include "net/test/spawned_test_server/spawned_test_server.h"
84 #include "testing/gtest/include/gtest/gtest.h" 83 #include "testing/gtest/include/gtest/gtest.h"
85 #include "ui/base/l10n/l10n_util.h" 84 #include "ui/base/l10n/l10n_util.h"
86 #include "webkit/plugins/npapi/mock_plugin_list.h"
87 85
88 using content::BrowserContext; 86 using content::BrowserContext;
89 using content::BrowserThread; 87 using content::BrowserThread;
90 using content::DownloadItem; 88 using content::DownloadItem;
91 using content::DownloadManager; 89 using content::DownloadManager;
92 using content::DownloadUrlParameters; 90 using content::DownloadUrlParameters;
93 using content::URLRequestMockHTTPJob; 91 using content::URLRequestMockHTTPJob;
94 using content::URLRequestSlowDownloadJob; 92 using content::URLRequestSlowDownloadJob;
95 using content::WebContents; 93 using content::WebContents;
96 using extensions::Extension; 94 using extensions::Extension;
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 ASSERT_TRUE(InitialSetup()); 464 ASSERT_TRUE(InitialSetup());
467 } 465 }
468 466
469 virtual void CleanUpOnMainThread() OVERRIDE { 467 virtual void CleanUpOnMainThread() OVERRIDE {
470 // Needs to be torn down on the main thread. file_activity_observer_ holds a 468 // Needs to be torn down on the main thread. file_activity_observer_ holds a
471 // reference to the ChromeDownloadManagerDelegate which should be destroyed 469 // reference to the ChromeDownloadManagerDelegate which should be destroyed
472 // on the UI thread. 470 // on the UI thread.
473 file_activity_observer_.reset(); 471 file_activity_observer_.reset();
474 } 472 }
475 473
474 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE {
475 command_line->AppendSwitch(switches::kDisablePluginsDiscovery);
476 }
477
476 // Returning false indicates a failure of the setup, and should be asserted 478 // Returning false indicates a failure of the setup, and should be asserted
477 // in the caller. 479 // in the caller.
478 virtual bool InitialSetup() { 480 virtual bool InitialSetup() {
479 bool have_test_dir = PathService::Get(chrome::DIR_TEST_DATA, &test_dir_); 481 bool have_test_dir = PathService::Get(chrome::DIR_TEST_DATA, &test_dir_);
480 EXPECT_TRUE(have_test_dir); 482 EXPECT_TRUE(have_test_dir);
481 if (!have_test_dir) 483 if (!have_test_dir)
482 return false; 484 return false;
483 485
484 // Sanity check default values for window / tab count and shelf visibility. 486 // Sanity check default values for window / tab count and shelf visibility.
485 int window_count = chrome::GetTotalBrowserCount(); 487 int window_count = chrome::GetTotalBrowserCount();
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 row1.interrupt_reason); 1845 row1.interrupt_reason);
1844 EXPECT_FALSE(row1.opened); 1846 EXPECT_FALSE(row1.opened);
1845 } 1847 }
1846 1848
1847 // Make sure a dangerous file shows up properly in the history. 1849 // Make sure a dangerous file shows up properly in the history.
1848 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryDangerCheck) { 1850 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadHistoryDangerCheck) {
1849 // .swf file so that it's dangerous on all platforms (including CrOS). 1851 // .swf file so that it's dangerous on all platforms (including CrOS).
1850 base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf")); 1852 base::FilePath file(FILE_PATH_LITERAL("downloads/dangerous/dangerous.swf"));
1851 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file)); 1853 GURL download_url(URLRequestMockHTTPJob::GetMockUrl(file));
1852 1854
1853 // Null out plugins so that flash plugin won't interfere with testing.
1854 #if defined(ENABLE_PLUGINS)
1855 webkit::npapi::MockPluginList plugin_list;
1856 content::PluginService::GetInstance()->SetPluginListForTesting(&plugin_list);
1857 #endif
1858
1859 // Download the url and wait until the object has been stored. 1855 // Download the url and wait until the object has been stored.
1860 scoped_ptr<content::DownloadTestObserver> download_observer( 1856 scoped_ptr<content::DownloadTestObserver> download_observer(
1861 new content::DownloadTestObserverTerminal( 1857 new content::DownloadTestObserverTerminal(
1862 DownloadManagerForBrowser(browser()), 1, 1858 DownloadManagerForBrowser(browser()), 1,
1863 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_IGNORE)); 1859 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_IGNORE));
1864 base::Time start(base::Time::Now()); 1860 base::Time start(base::Time::Now());
1865 HistoryObserver observer(browser()->profile()); 1861 HistoryObserver observer(browser()->profile());
1866 observer.SetFilterCallback(base::Bind(&HasDataAndName)); 1862 observer.SetFilterCallback(base::Bind(&HasDataAndName));
1867 ui_test_utils::NavigateToURL(browser(), download_url); 1863 ui_test_utils::NavigateToURL(browser(), download_url);
1868 observer.WaitForStored(); 1864 observer.WaitForStored();
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after
3227 3223
3228 // No errors this time. The download should complete successfully. 3224 // No errors this time. The download should complete successfully.
3229 EXPECT_FALSE(completion_observer->IsFinished()); 3225 EXPECT_FALSE(completion_observer->IsFinished());
3230 completion_observer->StartObserving(); 3226 completion_observer->StartObserving();
3231 download->Resume(); 3227 download->Resume();
3232 completion_observer->WaitForFinished(); 3228 completion_observer->WaitForFinished();
3233 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 3229 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
3234 3230
3235 EXPECT_FALSE(DidShowFileChooser()); 3231 EXPECT_FALSE(DidShowFileChooser());
3236 } 3232 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/content_settings/content_settings_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698