summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download/save_package_unittest.cc
diff options
context:
space:
mode:
authorestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 00:34:25 +0000
committerestade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 00:34:25 +0000
commit42fdf611a80359e16613fa5500bd6eb44956579a (patch)
tree8e0aac910bb953489b5459c0de67a879e27ea47d /chrome/browser/download/save_package_unittest.cc
parentad9d18b404c6af4837bd93ee512e1ba5c7f80a1f (diff)
downloadchromium_src-42fdf611a80359e16613fa5500bd6eb44956579a.zip
chromium_src-42fdf611a80359e16613fa5500bd6eb44956579a.tar.gz
chromium_src-42fdf611a80359e16613fa5500bd6eb44956579a.tar.bz2
Make default extension for downloading html "html" rather than "htm" on non-windows platforms.
BUG= http://crbug.com/15999 TEST=un-disable and run save page uitest on linux (it's only disabled because it's flaky, for some unrelated reason) Review URL: http://codereview.chromium.org/155095 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/save_package_unittest.cc')
-rw-r--r--chrome/browser/download/save_package_unittest.cc25
1 files changed, 17 insertions, 8 deletions
diff --git a/chrome/browser/download/save_package_unittest.cc b/chrome/browser/download/save_package_unittest.cc
index d828dcb..6522a80 100644
--- a/chrome/browser/download/save_package_unittest.cc
+++ b/chrome/browser/download/save_package_unittest.cc
@@ -11,6 +11,14 @@
#include "testing/gtest/include/gtest/gtest.h"
#define FPL FILE_PATH_LITERAL
+#if defined(OS_WIN)
+#define HTML_EXTENSION ".htm"
+// This second define is needed because MSVC is broken.
+#define FPL_HTML_EXTENSION L".htm"
+#else
+#define HTML_EXTENSION ".html"
+#define FPL_HTML_EXTENSION ".html"
+#endif
namespace {
@@ -52,7 +60,7 @@ class SavePackageTest : public testing::Test {
PathService::Get(base::DIR_TEMP, &test_dir);
save_package_success_ = new SavePackage(
- test_dir.AppendASCII("testfile.htm"),
+ test_dir.AppendASCII("testfile" HTML_EXTENSION),
test_dir.AppendASCII("testfile_files"));
// We need to construct a path that is *almost* kMaxFilePathLength long
@@ -62,7 +70,7 @@ class SavePackageTest : public testing::Test {
long_file_name.resize(kMaxFilePathLength - 9 - test_dir.value().length());
save_package_fail_ = new SavePackage(
- test_dir.AppendASCII(long_file_name + ".htm"),
+ test_dir.AppendASCII(long_file_name + HTML_EXTENSION),
test_dir.AppendASCII(long_file_name + "_files"));
}
@@ -103,7 +111,8 @@ static const struct {
// name from disposition and url has been tested in DownloadManagerTest.
// No useful information in disposition or URL, use default.
- {"1.html", "http://www.savepage.com/", FPL("saved_resource.htm"), true},
+ {"1.html", "http://www.savepage.com/",
+ FPL("saved_resource") FPL_HTML_EXTENSION, true},
// No duplicate occurs.
{"filename=1.css", "http://www.savepage.com", FPL("1.css"), false},
@@ -187,12 +196,12 @@ static const struct {
{FPL("filename.HTML"), FPL("filename.HTML")},
{FPL("filename.htm"), FPL("filename.htm")},
// ".htm" is added if the extension is improper for HTML.
- {FPL("hello.world"), FPL("hello.world.htm")},
- {FPL("hello.txt"), FPL("hello.txt.htm")},
- {FPL("is.html.good"), FPL("is.html.good.htm")},
+ {FPL("hello.world"), FPL("hello.world") FPL_HTML_EXTENSION},
+ {FPL("hello.txt"), FPL("hello.txt") FPL_HTML_EXTENSION},
+ {FPL("is.html.good"), FPL("is.html.good") FPL_HTML_EXTENSION},
// ".htm" is added if the name doesn't have an extension.
- {FPL("helloworld"), FPL("helloworld.htm")},
- {FPL("helloworld."), FPL("helloworld..htm")},
+ {FPL("helloworld"), FPL("helloworld") FPL_HTML_EXTENSION},
+ {FPL("helloworld."), FPL("helloworld.") FPL_HTML_EXTENSION},
};
TEST_F(SavePackageTest, TestEnsureHtmlExtension) {