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

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

Issue 7327007: Moving notification types which are chrome specific to a new header file chrome_notification_type... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 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 | « chrome/browser/default_plugin_uitest.cc ('k') | chrome/browser/download/download_crx_util.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/file_path.h" 5 #include "base/file_path.h"
6 #include "base/file_util.h" 6 #include "base/file_util.h"
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/scoped_temp_dir.h" 9 #include "base/scoped_temp_dir.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
(...skipping 11 matching lines...) Expand all
22 #include "chrome/browser/extensions/extension_install_ui.h" 22 #include "chrome/browser/extensions/extension_install_ui.h"
23 #include "chrome/browser/extensions/extension_service.h" 23 #include "chrome/browser/extensions/extension_service.h"
24 #include "chrome/browser/history/download_history_info.h" 24 #include "chrome/browser/history/download_history_info.h"
25 #include "chrome/browser/history/history.h" 25 #include "chrome/browser/history/history.h"
26 #include "chrome/browser/prefs/pref_service.h" 26 #include "chrome/browser/prefs/pref_service.h"
27 #include "chrome/browser/profiles/profile.h" 27 #include "chrome/browser/profiles/profile.h"
28 #include "chrome/browser/ui/browser.h" 28 #include "chrome/browser/ui/browser.h"
29 #include "chrome/browser/ui/browser_list.h" 29 #include "chrome/browser/ui/browser_list.h"
30 #include "chrome/browser/ui/browser_window.h" 30 #include "chrome/browser/ui/browser_window.h"
31 #include "chrome/browser/ui/webui/active_downloads_ui.h" 31 #include "chrome/browser/ui/webui/active_downloads_ui.h"
32 #include "chrome/common/chrome_notification_types.h"
32 #include "chrome/common/chrome_paths.h" 33 #include "chrome/common/chrome_paths.h"
33 #include "chrome/common/pref_names.h" 34 #include "chrome/common/pref_names.h"
34 #include "chrome/common/url_constants.h" 35 #include "chrome/common/url_constants.h"
35 #include "chrome/test/in_process_browser_test.h" 36 #include "chrome/test/in_process_browser_test.h"
36 #include "chrome/test/ui_test_utils.h" 37 #include "chrome/test/ui_test_utils.h"
37 #include "content/browser/cancelable_request.h" 38 #include "content/browser/cancelable_request.h"
38 #include "content/browser/net/url_request_mock_http_job.h" 39 #include "content/browser/net/url_request_mock_http_job.h"
39 #include "content/browser/renderer_host/resource_dispatcher_host.h" 40 #include "content/browser/renderer_host/resource_dispatcher_host.h"
40 #include "content/browser/tab_contents/tab_contents.h" 41 #include "content/browser/tab_contents/tab_contents.h"
41 #include "content/browser/net/url_request_slow_download_job.h" 42 #include "content/browser/net/url_request_slow_download_job.h"
(...skipping 1081 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 ExpectWindowCountAfterDownload(2); 1124 ExpectWindowCountAfterDownload(2);
1124 1125
1125 // Verify that the download shelf is showing for the Incognito window. 1126 // Verify that the download shelf is showing for the Incognito window.
1126 CheckDownloadUI(incognito, true, true, file); 1127 CheckDownloadUI(incognito, true, true, file);
1127 1128
1128 #if !defined(OS_MACOSX) 1129 #if !defined(OS_MACOSX)
1129 // On Mac OS X, the UI window close is delayed until the outermost 1130 // On Mac OS X, the UI window close is delayed until the outermost
1130 // message loop runs. So it isn't possible to get a BROWSER_CLOSED 1131 // message loop runs. So it isn't possible to get a BROWSER_CLOSED
1131 // notification inside of a test. 1132 // notification inside of a test.
1132 ui_test_utils::WindowedNotificationObserver signal( 1133 ui_test_utils::WindowedNotificationObserver signal(
1133 NotificationType::BROWSER_CLOSED, 1134 chrome::NOTIFICATION_BROWSER_CLOSED,
1134 Source<Browser>(incognito)); 1135 Source<Browser>(incognito));
1135 #endif 1136 #endif
1136 1137
1137 // Close the Incognito window and don't crash. 1138 // Close the Incognito window and don't crash.
1138 incognito->CloseWindow(); 1139 incognito->CloseWindow();
1139 1140
1140 #if !defined(OS_MACOSX) 1141 #if !defined(OS_MACOSX)
1141 signal.Wait(); 1142 signal.Wait();
1142 ExpectWindowCountAfterDownload(1); 1143 ExpectWindowCountAfterDownload(1);
1143 #endif 1144 #endif
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1374 ASSERT_TRUE(download_browser != NULL); 1375 ASSERT_TRUE(download_browser != NULL);
1375 EXPECT_NE(download_browser, browser()); 1376 EXPECT_NE(download_browser, browser());
1376 EXPECT_EQ(1, download_browser->tab_count()); 1377 EXPECT_EQ(1, download_browser->tab_count());
1377 CheckDownloadUI(download_browser, true, true, file); 1378 CheckDownloadUI(download_browser, true, true, file);
1378 1379
1379 #if !defined(OS_MACOSX) 1380 #if !defined(OS_MACOSX)
1380 // On Mac OS X, the UI window close is delayed until the outermost 1381 // On Mac OS X, the UI window close is delayed until the outermost
1381 // message loop runs. So it isn't possible to get a BROWSER_CLOSED 1382 // message loop runs. So it isn't possible to get a BROWSER_CLOSED
1382 // notification inside of a test. 1383 // notification inside of a test.
1383 ui_test_utils::WindowedNotificationObserver signal( 1384 ui_test_utils::WindowedNotificationObserver signal(
1384 NotificationType::BROWSER_CLOSED, 1385 chrome::NOTIFICATION_BROWSER_CLOSED,
1385 Source<Browser>(download_browser)); 1386 Source<Browser>(download_browser));
1386 #endif 1387 #endif
1387 1388
1388 // Close the new window. 1389 // Close the new window.
1389 download_browser->CloseWindow(); 1390 download_browser->CloseWindow();
1390 1391
1391 #if !defined(OS_MACOSX) 1392 #if !defined(OS_MACOSX)
1392 signal.Wait(); 1393 signal.Wait();
1393 EXPECT_EQ(first_browser, browser()); 1394 EXPECT_EQ(first_browser, browser());
1394 ExpectWindowCountAfterDownload(1); 1395 ExpectWindowCountAfterDownload(1);
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1534 contents->render_view_host(), 1535 contents->render_view_host(),
1535 L"", 1536 L"",
1536 L"window.onunload = function() { var do_nothing = 0; }; " 1537 L"window.onunload = function() { var do_nothing = 0; }; "
1537 L"window.domAutomationController.send(true);", 1538 L"window.domAutomationController.send(true);",
1538 &result)); 1539 &result));
1539 EXPECT_TRUE(result); 1540 EXPECT_TRUE(result);
1540 1541
1541 DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG); 1542 DownloadAndWait(browser(), download_url, EXPECT_NO_SELECT_DIALOG);
1542 1543
1543 ui_test_utils::WindowedNotificationObserver signal( 1544 ui_test_utils::WindowedNotificationObserver signal(
1544 NotificationType::BROWSER_CLOSED, 1545 chrome::NOTIFICATION_BROWSER_CLOSED,
1545 Source<Browser>(browser())); 1546 Source<Browser>(browser()));
1546 browser()->CloseWindow(); 1547 browser()->CloseWindow();
1547 signal.Wait(); 1548 signal.Wait();
1548 } 1549 }
1549 1550
1550 // Test to make sure auto-open works. 1551 // Test to make sure auto-open works.
1551 IN_PROC_BROWSER_TEST_F(DownloadTest, AutoOpen) { 1552 IN_PROC_BROWSER_TEST_F(DownloadTest, AutoOpen) {
1552 ASSERT_TRUE(InitialSetup(false)); 1553 ASSERT_TRUE(InitialSetup(false));
1553 FilePath file(FILE_PATH_LITERAL("download-autoopen.txt")); 1554 FilePath file(FILE_PATH_LITERAL("download-autoopen.txt"));
1554 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); 1555 GURL url(URLRequestMockHTTPJob::GetMockUrl(file));
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1710 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); 1711 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen());
1711 1712
1712 // Download shelf should close. Download panel stays open on ChromeOS. 1713 // Download shelf should close. Download panel stays open on ChromeOS.
1713 CheckDownloadUI(browser(), false, true, FilePath()); 1714 CheckDownloadUI(browser(), false, true, FilePath());
1714 1715
1715 // Check that the extension was installed. 1716 // Check that the extension was installed.
1716 ExtensionService* extension_service = 1717 ExtensionService* extension_service =
1717 browser()->profile()->GetExtensionService(); 1718 browser()->profile()->GetExtensionService();
1718 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); 1719 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false));
1719 } 1720 }
OLDNEW
« no previous file with comments | « chrome/browser/default_plugin_uitest.cc ('k') | chrome/browser/download/download_crx_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698