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

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

Issue 22694006: Infobar system refactor. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
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"
45 #include "chrome/browser/infobars/infobar_service.h" 46 #include "chrome/browser/infobars/infobar_service.h"
46 #include "chrome/browser/net/url_request_mock_util.h" 47 #include "chrome/browser/net/url_request_mock_util.h"
47 #include "chrome/browser/profiles/profile.h" 48 #include "chrome/browser/profiles/profile.h"
48 #include "chrome/browser/tab_contents/render_view_context_menu.h" 49 #include "chrome/browser/tab_contents/render_view_context_menu.h"
49 #include "chrome/browser/ui/browser.h" 50 #include "chrome/browser/ui/browser.h"
50 #include "chrome/browser/ui/browser_commands.h" 51 #include "chrome/browser/ui/browser_commands.h"
51 #include "chrome/browser/ui/browser_finder.h" 52 #include "chrome/browser/ui/browser_finder.h"
52 #include "chrome/browser/ui/browser_list.h" 53 #include "chrome/browser/ui/browser_list.h"
53 #include "chrome/browser/ui/browser_tabstrip.h" 54 #include "chrome/browser/ui/browser_tabstrip.h"
54 #include "chrome/browser/ui/browser_window.h" 55 #include "chrome/browser/ui/browser_window.h"
(...skipping 2753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2808 browser(), 2809 browser(),
2809 test_server()->GetURL("files/downloads/download-a_zip_file.html")); 2810 test_server()->GetURL("files/downloads/download-a_zip_file.html"));
2810 infobar_added_1.Wait(); 2811 infobar_added_1.Wait();
2811 2812
2812 InfoBarService* infobar_service = InfoBarService::FromWebContents( 2813 InfoBarService* infobar_service = InfoBarService::FromWebContents(
2813 browser()->tab_strip_model()->GetActiveWebContents()); 2814 browser()->tab_strip_model()->GetActiveWebContents());
2814 // Verify that there is only one infobar. 2815 // Verify that there is only one infobar.
2815 ASSERT_EQ(1u, infobar_service->infobar_count()); 2816 ASSERT_EQ(1u, infobar_service->infobar_count());
2816 2817
2817 // Get the infobar at index 0. 2818 // Get the infobar at index 0.
2818 InfoBarDelegate* infobar = infobar_service->infobar_at(0); 2819 InfoBar* infobar = infobar_service->infobar_at(0);
2819 ConfirmInfoBarDelegate* confirm_infobar = infobar->AsConfirmInfoBarDelegate(); 2820 ConfirmInfoBarDelegate* confirm_infobar =
2821 infobar->delegate()->AsConfirmInfoBarDelegate();
2820 ASSERT_TRUE(confirm_infobar != NULL); 2822 ASSERT_TRUE(confirm_infobar != NULL);
2821 2823
2822 // Verify multi download warning infobar message. 2824 // Verify multi download warning infobar message.
2823 EXPECT_EQ(confirm_infobar->GetMessageText(), 2825 EXPECT_EQ(confirm_infobar->GetMessageText(),
2824 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING)); 2826 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING));
2825 2827
2826 // Click on the "Allow" button to allow multiple downloads. 2828 // Click on the "Allow" button to allow multiple downloads.
2827 if (confirm_infobar->Accept()) 2829 if (confirm_infobar->Accept())
2828 infobar_service->RemoveInfoBar(infobar); 2830 infobar_service->RemoveInfoBar(infobar);
2829 // Verify that there are no more infobars. 2831 // Verify that there are no more infobars.
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
3250 3252
3251 // No errors this time. The download should complete successfully. 3253 // No errors this time. The download should complete successfully.
3252 EXPECT_FALSE(completion_observer->IsFinished()); 3254 EXPECT_FALSE(completion_observer->IsFinished());
3253 completion_observer->StartObserving(); 3255 completion_observer->StartObserving();
3254 download->Resume(); 3256 download->Resume();
3255 completion_observer->WaitForFinished(); 3257 completion_observer->WaitForFinished();
3256 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 3258 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
3257 3259
3258 EXPECT_FALSE(DidShowFileChooser()); 3260 EXPECT_FALSE(DidShowFileChooser());
3259 } 3261 }
OLDNEW
« no previous file with comments | « chrome/browser/devtools/devtools_window.cc ('k') | chrome/browser/download/download_request_infobar_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698