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

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

Issue 977863002: Revert of Add new test: DownloadTest.TestMultipleDownloadsBubble (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | 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/files/file.h" 10 #include "base/files/file.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti l.h" 49 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti l.h"
50 #include "chrome/browser/ui/browser.h" 50 #include "chrome/browser/ui/browser.h"
51 #include "chrome/browser/ui/browser_commands.h" 51 #include "chrome/browser/ui/browser_commands.h"
52 #include "chrome/browser/ui/browser_finder.h" 52 #include "chrome/browser/ui/browser_finder.h"
53 #include "chrome/browser/ui/browser_list.h" 53 #include "chrome/browser/ui/browser_list.h"
54 #include "chrome/browser/ui/browser_tabstrip.h" 54 #include "chrome/browser/ui/browser_tabstrip.h"
55 #include "chrome/browser/ui/browser_window.h" 55 #include "chrome/browser/ui/browser_window.h"
56 #include "chrome/browser/ui/chrome_pages.h" 56 #include "chrome/browser/ui/chrome_pages.h"
57 #include "chrome/browser/ui/host_desktop.h" 57 #include "chrome/browser/ui/host_desktop.h"
58 #include "chrome/browser/ui/tabs/tab_strip_model.h" 58 #include "chrome/browser/ui/tabs/tab_strip_model.h"
59 #include "chrome/browser/ui/website_settings/mock_permission_bubble_view.h"
60 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
61 #include "chrome/common/chrome_paths.h" 59 #include "chrome/common/chrome_paths.h"
62 #include "chrome/common/chrome_switches.h"
63 #include "chrome/common/pref_names.h" 60 #include "chrome/common/pref_names.h"
64 #include "chrome/common/safe_browsing/csd.pb.h" 61 #include "chrome/common/safe_browsing/csd.pb.h"
65 #include "chrome/common/url_constants.h" 62 #include "chrome/common/url_constants.h"
66 #include "chrome/grit/generated_resources.h" 63 #include "chrome/grit/generated_resources.h"
67 #include "chrome/test/base/in_process_browser_test.h" 64 #include "chrome/test/base/in_process_browser_test.h"
68 #include "chrome/test/base/test_switches.h" 65 #include "chrome/test/base/test_switches.h"
69 #include "chrome/test/base/ui_test_utils.h" 66 #include "chrome/test/base/ui_test_utils.h"
70 #include "components/history/content/browser/download_constants_utils.h" 67 #include "components/history/content/browser/download_constants_utils.h"
71 #include "components/history/core/browser/download_constants.h" 68 #include "components/history/core/browser/download_constants.h"
72 #include "components/history/core/browser/download_row.h" 69 #include "components/history/core/browser/download_row.h"
(...skipping 2815 matching lines...) Expand 10 before | Expand all | Expand 10 after
2888 IN_PROC_BROWSER_TEST_F(DownloadTest, TestMultipleDownloadsInfobar) { 2885 IN_PROC_BROWSER_TEST_F(DownloadTest, TestMultipleDownloadsInfobar) {
2889 #if defined(OS_WIN) && defined(USE_ASH) 2886 #if defined(OS_WIN) && defined(USE_ASH)
2890 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 2887 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
2891 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 2888 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2892 switches::kAshBrowserTests)) 2889 switches::kAshBrowserTests))
2893 return; 2890 return;
2894 #endif 2891 #endif
2895 2892
2896 ASSERT_TRUE(test_server()->Start()); 2893 ASSERT_TRUE(test_server()->Start());
2897 2894
2898 // Ensure that infobars are being used instead of bubbles.
2899 base::CommandLine::ForCurrentProcess()->AppendSwitch(
2900 switches::kDisablePermissionsBubbles);
2901
2902 // Create a downloads observer. 2895 // Create a downloads observer.
2903 scoped_ptr<content::DownloadTestObserver> downloads_observer( 2896 scoped_ptr<content::DownloadTestObserver> downloads_observer(
2904 CreateWaiter(browser(), 2)); 2897 CreateWaiter(browser(), 2));
2905 2898
2906 // Create an infobar observer. 2899 // Create an infobar observer.
2907 content::WindowedNotificationObserver infobar_added_1( 2900 content::WindowedNotificationObserver infobar_added_1(
2908 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED, 2901 chrome::NOTIFICATION_TAB_CONTENTS_INFOBAR_ADDED,
2909 content::NotificationService::AllSources()); 2902 content::NotificationService::AllSources());
2910 ui_test_utils::NavigateToURL( 2903 ui_test_utils::NavigateToURL(
2911 browser(), 2904 browser(),
(...skipping 20 matching lines...) Expand all
2932 infobar_service->RemoveInfoBar(infobar); 2925 infobar_service->RemoveInfoBar(infobar);
2933 // Verify that there are no more infobars. 2926 // Verify that there are no more infobars.
2934 EXPECT_EQ(0u, infobar_service->infobar_count()); 2927 EXPECT_EQ(0u, infobar_service->infobar_count());
2935 2928
2936 // Waits for the download to complete. 2929 // Waits for the download to complete.
2937 downloads_observer->WaitForFinished(); 2930 downloads_observer->WaitForFinished();
2938 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState( 2931 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState(
2939 DownloadItem::COMPLETE)); 2932 DownloadItem::COMPLETE));
2940 } 2933 }
2941 2934
2942 IN_PROC_BROWSER_TEST_F(DownloadTest, TestMultipleDownloadsBubble) {
2943 #if defined(OS_WIN) && defined(USE_ASH)
2944 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
2945 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
2946 switches::kAshBrowserTests))
2947 return;
2948 #endif
2949
2950 #if defined(OS_ANDROID) || defined(OS_IOS)
2951 // Permission bubbles are not supported on mobile.
2952 return;
2953 #endif
2954
2955 ASSERT_TRUE(test_server()->Start());
2956
2957 // Enable permision bubbles.
2958 base::CommandLine::ForCurrentProcess()->AppendSwitch(
2959 switches::kEnablePermissionsBubbles);
2960
2961 // Create a downloads observer.
2962 scoped_ptr<content::DownloadTestObserver> downloads_observer(
2963 CreateWaiter(browser(), 2));
2964
2965 MockPermissionBubbleView* mock_bubble_view = new MockPermissionBubbleView();
2966 PermissionBubbleManager::FromWebContents(
2967 browser()->tab_strip_model()->GetActiveWebContents())->
2968 SetView(mock_bubble_view);
2969 mock_bubble_view->SetBrowserTest(true);
2970 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(
2971 browser(),
2972 test_server()->GetURL("files/downloads/download-a_zip_file.html"), 1);
2973
2974 ASSERT_TRUE(mock_bubble_view->IsVisible());
2975 mock_bubble_view->Accept();
2976 ASSERT_FALSE(mock_bubble_view->IsVisible());
2977
2978 // Waits for the download to complete.
2979 downloads_observer->WaitForFinished();
2980 EXPECT_EQ(2u, downloads_observer->NumDownloadsSeenInState(
2981 DownloadItem::COMPLETE));
2982
2983 browser()->tab_strip_model()->GetActiveWebContents()->Close();
2984 delete mock_bubble_view;
2985 }
2986
2987 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) { 2935 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_Renaming) {
2988 ASSERT_TRUE(test_server()->Start()); 2936 ASSERT_TRUE(test_server()->Start());
2989 GURL url(test_server()->GetURL("files/downloads/a_zip_file.zip")); 2937 GURL url(test_server()->GetURL("files/downloads/a_zip_file.zip"));
2990 content::DownloadManager* manager = DownloadManagerForBrowser(browser()); 2938 content::DownloadManager* manager = DownloadManagerForBrowser(browser());
2991 base::FilePath origin_file(OriginFile(base::FilePath(FILE_PATH_LITERAL( 2939 base::FilePath origin_file(OriginFile(base::FilePath(FILE_PATH_LITERAL(
2992 "downloads/a_zip_file.zip")))); 2940 "downloads/a_zip_file.zip"))));
2993 ASSERT_TRUE(base::PathExists(origin_file)); 2941 ASSERT_TRUE(base::PathExists(origin_file));
2994 std::string origin_contents; 2942 std::string origin_contents;
2995 ASSERT_TRUE(base::ReadFileToString(origin_file, &origin_contents)); 2943 ASSERT_TRUE(base::ReadFileToString(origin_file, &origin_contents));
2996 2944
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
3577 *(downloads[0]))); 3525 *(downloads[0])));
3578 3526
3579 // Begin feedback and check that the file is "stolen". 3527 // Begin feedback and check that the file is "stolen".
3580 download_protection_service->feedback_service()->BeginFeedbackForDownload( 3528 download_protection_service->feedback_service()->BeginFeedbackForDownload(
3581 downloads[0]); 3529 downloads[0]);
3582 std::vector<DownloadItem*> updated_downloads; 3530 std::vector<DownloadItem*> updated_downloads;
3583 GetDownloads(browser(), &updated_downloads); 3531 GetDownloads(browser(), &updated_downloads);
3584 ASSERT_TRUE(updated_downloads.empty()); 3532 ASSERT_TRUE(updated_downloads.empty());
3585 } 3533 }
3586 #endif 3534 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698