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

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

Issue 102163002: Revert 238283 "Infobar system refactor." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years 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
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 24 matching lines...) Expand all
35 #include "chrome/browser/download/download_shelf.h" 35 #include "chrome/browser/download/download_shelf.h"
36 #include "chrome/browser/download/download_target_determiner.h" 36 #include "chrome/browser/download/download_target_determiner.h"
37 #include "chrome/browser/download/download_test_file_activity_observer.h" 37 #include "chrome/browser/download/download_test_file_activity_observer.h"
38 #include "chrome/browser/extensions/extension_install_prompt.h" 38 #include "chrome/browser/extensions/extension_install_prompt.h"
39 #include "chrome/browser/extensions/extension_service.h" 39 #include "chrome/browser/extensions/extension_service.h"
40 #include "chrome/browser/extensions/extension_system.h" 40 #include "chrome/browser/extensions/extension_system.h"
41 #include "chrome/browser/history/download_row.h" 41 #include "chrome/browser/history/download_row.h"
42 #include "chrome/browser/history/history_service.h" 42 #include "chrome/browser/history/history_service.h"
43 #include "chrome/browser/history/history_service_factory.h" 43 #include "chrome/browser/history/history_service_factory.h"
44 #include "chrome/browser/infobars/confirm_infobar_delegate.h" 44 #include "chrome/browser/infobars/confirm_infobar_delegate.h"
45 #include "chrome/browser/infobars/infobar.h"
46 #include "chrome/browser/infobars/infobar_service.h" 45 #include "chrome/browser/infobars/infobar_service.h"
47 #include "chrome/browser/net/url_request_mock_util.h" 46 #include "chrome/browser/net/url_request_mock_util.h"
48 #include "chrome/browser/profiles/profile.h" 47 #include "chrome/browser/profiles/profile.h"
49 #include "chrome/browser/tab_contents/render_view_context_menu.h" 48 #include "chrome/browser/tab_contents/render_view_context_menu.h"
50 #include "chrome/browser/ui/browser.h" 49 #include "chrome/browser/ui/browser.h"
51 #include "chrome/browser/ui/browser_commands.h" 50 #include "chrome/browser/ui/browser_commands.h"
52 #include "chrome/browser/ui/browser_finder.h" 51 #include "chrome/browser/ui/browser_finder.h"
53 #include "chrome/browser/ui/browser_list.h" 52 #include "chrome/browser/ui/browser_list.h"
54 #include "chrome/browser/ui/browser_tabstrip.h" 53 #include "chrome/browser/ui/browser_tabstrip.h"
55 #include "chrome/browser/ui/browser_window.h" 54 #include "chrome/browser/ui/browser_window.h"
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2809 browser(), 2808 browser(),
2810 test_server()->GetURL("files/downloads/download-a_zip_file.html")); 2809 test_server()->GetURL("files/downloads/download-a_zip_file.html"));
2811 infobar_added_1.Wait(); 2810 infobar_added_1.Wait();
2812 2811
2813 InfoBarService* infobar_service = InfoBarService::FromWebContents( 2812 InfoBarService* infobar_service = InfoBarService::FromWebContents(
2814 browser()->tab_strip_model()->GetActiveWebContents()); 2813 browser()->tab_strip_model()->GetActiveWebContents());
2815 // Verify that there is only one infobar. 2814 // Verify that there is only one infobar.
2816 ASSERT_EQ(1u, infobar_service->infobar_count()); 2815 ASSERT_EQ(1u, infobar_service->infobar_count());
2817 2816
2818 // Get the infobar at index 0. 2817 // Get the infobar at index 0.
2819 InfoBar* infobar = infobar_service->infobar_at(0); 2818 InfoBarDelegate* infobar = infobar_service->infobar_at(0);
2820 ConfirmInfoBarDelegate* confirm_infobar = 2819 ConfirmInfoBarDelegate* confirm_infobar = infobar->AsConfirmInfoBarDelegate();
2821 infobar->delegate()->AsConfirmInfoBarDelegate();
2822 ASSERT_TRUE(confirm_infobar != NULL); 2820 ASSERT_TRUE(confirm_infobar != NULL);
2823 2821
2824 // Verify multi download warning infobar message. 2822 // Verify multi download warning infobar message.
2825 EXPECT_EQ(confirm_infobar->GetMessageText(), 2823 EXPECT_EQ(confirm_infobar->GetMessageText(),
2826 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING)); 2824 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING));
2827 2825
2828 // Click on the "Allow" button to allow multiple downloads. 2826 // Click on the "Allow" button to allow multiple downloads.
2829 if (confirm_infobar->Accept()) 2827 if (confirm_infobar->Accept())
2830 infobar_service->RemoveInfoBar(infobar); 2828 infobar_service->RemoveInfoBar(infobar);
2831 // Verify that there are no more infobars. 2829 // Verify that there are no more infobars.
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 3250
3253 // No errors this time. The download should complete successfully. 3251 // No errors this time. The download should complete successfully.
3254 EXPECT_FALSE(completion_observer->IsFinished()); 3252 EXPECT_FALSE(completion_observer->IsFinished());
3255 completion_observer->StartObserving(); 3253 completion_observer->StartObserving();
3256 download->Resume(); 3254 download->Resume();
3257 completion_observer->WaitForFinished(); 3255 completion_observer->WaitForFinished();
3258 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 3256 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
3259 3257
3260 EXPECT_FALSE(DidShowFileChooser()); 3258 EXPECT_FALSE(DidShowFileChooser());
3261 } 3259 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698