OLD | NEW |
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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/test/base/ui_test_utils.h" | 39 #include "chrome/test/base/ui_test_utils.h" |
40 #include "content/browser/cancelable_request.h" | 40 #include "content/browser/cancelable_request.h" |
41 #include "content/browser/download/download_file_manager.h" | 41 #include "content/browser/download/download_file_manager.h" |
42 #include "content/browser/download/download_item.h" | 42 #include "content/browser/download/download_item.h" |
43 #include "content/browser/download/download_manager.h" | 43 #include "content/browser/download/download_manager.h" |
44 #include "content/browser/download/download_persistent_store_info.h" | 44 #include "content/browser/download/download_persistent_store_info.h" |
45 #include "content/browser/net/url_request_mock_http_job.h" | 45 #include "content/browser/net/url_request_mock_http_job.h" |
46 #include "content/browser/renderer_host/resource_dispatcher_host.h" | 46 #include "content/browser/renderer_host/resource_dispatcher_host.h" |
47 #include "content/browser/tab_contents/tab_contents.h" | 47 #include "content/browser/tab_contents/tab_contents.h" |
48 #include "content/browser/net/url_request_slow_download_job.h" | 48 #include "content/browser/net/url_request_slow_download_job.h" |
49 #include "content/common/page_transition_types.h" | 49 #include "content/public/common/page_transition_types.h" |
50 #include "net/base/net_util.h" | 50 #include "net/base/net_util.h" |
51 #include "testing/gtest/include/gtest/gtest.h" | 51 #include "testing/gtest/include/gtest/gtest.h" |
52 | 52 |
53 namespace { | 53 namespace { |
54 | 54 |
55 // IDs and paths of CRX files used in tests. | 55 // IDs and paths of CRX files used in tests. |
56 const char kGoodCrxId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; | 56 const char kGoodCrxId[] = "ldnnhddmnhbkjipkidpdiheffobcpfmf"; |
57 const FilePath kGoodCrxPath(FILE_PATH_LITERAL("extensions/good.crx")); | 57 const FilePath kGoodCrxPath(FILE_PATH_LITERAL("extensions/good.crx")); |
58 | 58 |
59 const char kLargeThemeCrxId[] = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; | 59 const char kLargeThemeCrxId[] = "pjpgmfcmabopnnfonnhmdjglfpjjfkbf"; |
(...skipping 1049 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); | 1109 DownloadAndWait(browser(), url, EXPECT_NO_SELECT_DIALOG); |
1110 | 1110 |
1111 CheckDownload(browser(), download_file, file); | 1111 CheckDownload(browser(), download_file, file); |
1112 | 1112 |
1113 // Check state. | 1113 // Check state. |
1114 EXPECT_EQ(1, browser()->tab_count()); | 1114 EXPECT_EQ(1, browser()->tab_count()); |
1115 CheckDownloadUI(browser(), true, true, download_file); | 1115 CheckDownloadUI(browser(), true, true, download_file); |
1116 | 1116 |
1117 // Open a second tab and wait. | 1117 // Open a second tab and wait. |
1118 EXPECT_NE(static_cast<TabContentsWrapper*>(NULL), | 1118 EXPECT_NE(static_cast<TabContentsWrapper*>(NULL), |
1119 browser()->AddSelectedTabWithURL(GURL(), PageTransition::TYPED)); | 1119 browser()->AddSelectedTabWithURL( |
| 1120 GURL(), content::PAGE_TRANSITION_TYPED)); |
1120 EXPECT_EQ(2, browser()->tab_count()); | 1121 EXPECT_EQ(2, browser()->tab_count()); |
1121 CheckDownloadUI(browser(), true, true, download_file); | 1122 CheckDownloadUI(browser(), true, true, download_file); |
1122 | 1123 |
1123 // Hide the download shelf. | 1124 // Hide the download shelf. |
1124 browser()->window()->GetDownloadShelf()->Close(); | 1125 browser()->window()->GetDownloadShelf()->Close(); |
1125 CheckDownloadUI(browser(), false, false, FilePath()); | 1126 CheckDownloadUI(browser(), false, false, FilePath()); |
1126 | 1127 |
1127 // Go to the first tab. | 1128 // Go to the first tab. |
1128 browser()->ActivateTabAt(0, true); | 1129 browser()->ActivateTabAt(0, true); |
1129 EXPECT_EQ(2, browser()->tab_count()); | 1130 EXPECT_EQ(2, browser()->tab_count()); |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1780 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); | 1781 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); |
1781 | 1782 |
1782 // Download shelf should close. Download panel stays open on ChromeOS. | 1783 // Download shelf should close. Download panel stays open on ChromeOS. |
1783 CheckDownloadUI(browser(), false, true, FilePath()); | 1784 CheckDownloadUI(browser(), false, true, FilePath()); |
1784 | 1785 |
1785 // Check that the extension was installed. | 1786 // Check that the extension was installed. |
1786 ExtensionService* extension_service = | 1787 ExtensionService* extension_service = |
1787 browser()->profile()->GetExtensionService(); | 1788 browser()->profile()->GetExtensionService(); |
1788 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); | 1789 ASSERT_TRUE(extension_service->GetExtensionById(kLargeThemeCrxId, false)); |
1789 } | 1790 } |
OLD | NEW |