| OLD | NEW |
| 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 3040 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3051 #if defined(OS_WIN) | 3051 #if defined(OS_WIN) |
| 3052 ASSERT_EQ(1, downloaded_size); | 3052 ASSERT_EQ(1, downloaded_size); |
| 3053 #else | 3053 #else |
| 3054 ASSERT_EQ(size + 1, downloaded_size); | 3054 ASSERT_EQ(size + 1, downloaded_size); |
| 3055 #endif | 3055 #endif |
| 3056 ASSERT_TRUE(file_util::DieFileDie(file_path, false)); | 3056 ASSERT_TRUE(file_util::DieFileDie(file_path, false)); |
| 3057 ASSERT_TRUE(file_util::DieFileDie(download_items[0]->GetTargetFilePath(), | 3057 ASSERT_TRUE(file_util::DieFileDie(download_items[0]->GetTargetFilePath(), |
| 3058 false)); | 3058 false)); |
| 3059 } | 3059 } |
| 3060 | 3060 |
| 3061 IN_PROC_BROWSER_TEST_F(DownloadTest, DownloadTest_DenyDanger) { | 3061 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(USE_AURA) |
| 3062 // TODO(erg): linux_aura bringup: http://crbug.com/163931 |
| 3063 #define MAYBE_DownloadTest_DenyDanger DISABLED_DownloadTest_DenyDanger |
| 3064 #else |
| 3065 #define MAYBE_DownloadTest_DenyDanger DownloadTest_DenyDanger |
| 3066 #endif |
| 3067 |
| 3068 IN_PROC_BROWSER_TEST_F(DownloadTest, MAYBE_DownloadTest_DenyDanger) { |
| 3062 ASSERT_TRUE(test_server()->Start()); | 3069 ASSERT_TRUE(test_server()->Start()); |
| 3063 GURL url(test_server()->GetURL("files/downloads/dangerous/dangerous.crx")); | 3070 GURL url(test_server()->GetURL("files/downloads/dangerous/dangerous.crx")); |
| 3064 scoped_ptr<content::DownloadTestObserver> observer( | 3071 scoped_ptr<content::DownloadTestObserver> observer( |
| 3065 DangerousDownloadWaiter( | 3072 DangerousDownloadWaiter( |
| 3066 browser(), 1, | 3073 browser(), 1, |
| 3067 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); | 3074 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY)); |
| 3068 ui_test_utils::NavigateToURL(browser(), url); | 3075 ui_test_utils::NavigateToURL(browser(), url); |
| 3069 observer->WaitForFinished(); | 3076 observer->WaitForFinished(); |
| 3070 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED)); | 3077 EXPECT_EQ(1u, observer->NumDownloadsSeenInState(DownloadItem::CANCELLED)); |
| 3071 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); | 3078 EXPECT_EQ(1u, observer->NumDangerousDownloadsSeen()); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3243 | 3250 |
| 3244 // No errors this time. The download should complete successfully. | 3251 // No errors this time. The download should complete successfully. |
| 3245 EXPECT_FALSE(completion_observer->IsFinished()); | 3252 EXPECT_FALSE(completion_observer->IsFinished()); |
| 3246 completion_observer->StartObserving(); | 3253 completion_observer->StartObserving(); |
| 3247 download->Resume(); | 3254 download->Resume(); |
| 3248 completion_observer->WaitForFinished(); | 3255 completion_observer->WaitForFinished(); |
| 3249 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); | 3256 EXPECT_EQ(DownloadItem::COMPLETE, download->GetState()); |
| 3250 | 3257 |
| 3251 EXPECT_FALSE(DidShowFileChooser()); | 3258 EXPECT_FALSE(DidShowFileChooser()); |
| 3252 } | 3259 } |
| OLD | NEW |