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

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, 2 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
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 2755 matching lines...) Expand 10 before | Expand all | Expand 10 after
2810 browser(), 2811 browser(),
2811 test_server()->GetURL("files/downloads/download-a_zip_file.html")); 2812 test_server()->GetURL("files/downloads/download-a_zip_file.html"));
2812 infobar_added_1.Wait(); 2813 infobar_added_1.Wait();
2813 2814
2814 InfoBarService* infobar_service = InfoBarService::FromWebContents( 2815 InfoBarService* infobar_service = InfoBarService::FromWebContents(
2815 browser()->tab_strip_model()->GetActiveWebContents()); 2816 browser()->tab_strip_model()->GetActiveWebContents());
2816 // Verify that there is only one infobar. 2817 // Verify that there is only one infobar.
2817 ASSERT_EQ(1u, infobar_service->infobar_count()); 2818 ASSERT_EQ(1u, infobar_service->infobar_count());
2818 2819
2819 // Get the infobar at index 0. 2820 // Get the infobar at index 0.
2820 InfoBarDelegate* infobar = infobar_service->infobar_at(0); 2821 InfoBar* infobar = infobar_service->infobar_at(0);
2821 ConfirmInfoBarDelegate* confirm_infobar = infobar->AsConfirmInfoBarDelegate(); 2822 ConfirmInfoBarDelegate* confirm_infobar =
2823 infobar->delegate()->AsConfirmInfoBarDelegate();
2822 ASSERT_TRUE(confirm_infobar != NULL); 2824 ASSERT_TRUE(confirm_infobar != NULL);
2823 2825
2824 // Verify multi download warning infobar message. 2826 // Verify multi download warning infobar message.
2825 EXPECT_EQ(confirm_infobar->GetMessageText(), 2827 EXPECT_EQ(confirm_infobar->GetMessageText(),
2826 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING)); 2828 l10n_util::GetStringUTF16(IDS_MULTI_DOWNLOAD_WARNING));
2827 2829
2828 // Click on the "Allow" button to allow multiple downloads. 2830 // Click on the "Allow" button to allow multiple downloads.
2829 if (confirm_infobar->Accept()) 2831 if (confirm_infobar->Accept())
2830 infobar_service->RemoveInfoBar(infobar); 2832 infobar_service->RemoveInfoBar(infobar);
2831 // Verify that there are no more infobars. 2833 // Verify that there are no more infobars.
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
3245 3247
3246 // No errors this time. The download should complete successfully. 3248 // No errors this time. The download should complete successfully.
3247 EXPECT_FALSE(completion_observer->IsFinished()); 3249 EXPECT_FALSE(completion_observer->IsFinished());
3248 completion_observer->StartObserving(); 3250 completion_observer->StartObserving();
3249 download->Resume(); 3251 download->Resume();
3250 completion_observer->WaitForFinished(); 3252 completion_observer->WaitForFinished();
3251 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); 3253 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState());
3252 3254
3253 EXPECT_FALSE(DidShowFileChooser()); 3255 EXPECT_FALSE(DidShowFileChooser());
3254 } 3256 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698