| 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 // Disable everything on windows only. http://crbug.com/306144 | 5 // Disable everything on windows only. http://crbug.com/306144 |
| 6 #ifndef OS_WIN | 6 #ifndef OS_WIN |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1673 GoOnTheRecord(); | 1673 GoOnTheRecord(); |
| 1674 | 1674 |
| 1675 EXPECT_STREQ(errors::kInvalidFilename, | 1675 EXPECT_STREQ(errors::kInvalidFilename, |
| 1676 RunFunctionAndReturnError(new DownloadsDownloadFunction(), | 1676 RunFunctionAndReturnError(new DownloadsDownloadFunction(), |
| 1677 base::StringPrintf( | 1677 base::StringPrintf( |
| 1678 "[{\"url\": \"%s\"," | 1678 "[{\"url\": \"%s\"," |
| 1679 " \"filename\": \"../../../../../etc/passwd\"}]", | 1679 " \"filename\": \"../../../../../etc/passwd\"}]", |
| 1680 download_url.c_str())).c_str()); | 1680 download_url.c_str())).c_str()); |
| 1681 } | 1681 } |
| 1682 | 1682 |
| 1683 // flaky on mac: crbug.com/392288 |
| 1684 #if defined(OS_MACOSX) |
| 1685 #define MAYBE_DownloadExtensionTest_Download_InvalidURLs \ |
| 1686 DISABLED_DownloadExtensionTest_Download_InvalidURLs |
| 1687 #else |
| 1688 #define MAYBE_DownloadExtensionTest_Download_InvalidURLs \ |
| 1689 DownloadExtensionTest_Download_InvalidURLs |
| 1690 #endif |
| 1691 |
| 1683 // Test that downloading invalid URLs immediately returns kInvalidURLError. | 1692 // Test that downloading invalid URLs immediately returns kInvalidURLError. |
| 1684 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, | 1693 IN_PROC_BROWSER_TEST_F(DownloadExtensionTest, |
| 1685 DownloadExtensionTest_Download_InvalidURLs) { | 1694 MAYBE_DownloadExtensionTest_Download_InvalidURLs) { |
| 1686 LoadExtension("downloads_split"); | 1695 LoadExtension("downloads_split"); |
| 1687 GoOnTheRecord(); | 1696 GoOnTheRecord(); |
| 1688 | 1697 |
| 1689 static const char* kInvalidURLs[] = { | 1698 static const char* kInvalidURLs[] = { |
| 1690 "foo bar", | 1699 "foo bar", |
| 1691 "../hello", | 1700 "../hello", |
| 1692 "/hello", | 1701 "/hello", |
| 1693 "http://", | 1702 "http://", |
| 1694 "#frag", | 1703 "#frag", |
| 1695 "foo/bar.html#frag", | 1704 "foo/bar.html#frag", |
| (...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4093 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); | 4102 EXPECT_EQ(downloads::FILENAME_CONFLICT_ACTION_PROMPT, conflict_action); |
| 4094 EXPECT_FALSE(warnings.empty()); | 4103 EXPECT_FALSE(warnings.empty()); |
| 4095 EXPECT_EQ(ExtensionWarning::kDownloadFilenameConflict, | 4104 EXPECT_EQ(ExtensionWarning::kDownloadFilenameConflict, |
| 4096 warnings.begin()->warning_type()); | 4105 warnings.begin()->warning_type()); |
| 4097 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); | 4106 EXPECT_EQ("incumbent", warnings.begin()->extension_id()); |
| 4098 } | 4107 } |
| 4099 | 4108 |
| 4100 } // namespace extensions | 4109 } // namespace extensions |
| 4101 | 4110 |
| 4102 #endif // http://crbug.com/3061144 | 4111 #endif // http://crbug.com/3061144 |
| OLD | NEW |