diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 02:10:20 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-07 02:10:20 +0000 |
commit | 047a03f4cefa75a67070f08b3f6b727f7ea702d5 (patch) | |
tree | d00ccbd9e59106de8fd904b06720be59219d61fe /chrome/browser/download/download_manager_unittest.cc | |
parent | 0511c153260e5d402d7552ff7b47a2acb17bdf2b (diff) | |
download | chromium_src-047a03f4cefa75a67070f08b3f6b727f7ea702d5.zip chromium_src-047a03f4cefa75a67070f08b3f6b727f7ea702d5.tar.gz chromium_src-047a03f4cefa75a67070f08b3f6b727f7ea702d5.tar.bz2 |
Copy the relevant parts of ICU to a new file base/third_party/icu/icu_utf.*
so we can do basic UTF8/16/32 conversions without linking all of ICU.
Change callers who used to call SysUTF8ToWide/SysWideToUTF8 in base to using
these new functions. I will remove the Sys versions of these functions in a
later patch.
TEST=none
BUG=none
Review URL: http://codereview.chromium.org/243102
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@28219 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download/download_manager_unittest.cc')
-rw-r--r-- | chrome/browser/download/download_manager_unittest.cc | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/download/download_manager_unittest.cc b/chrome/browser/download/download_manager_unittest.cc index 164c92b..a5058cf 100644 --- a/chrome/browser/download/download_manager_unittest.cc +++ b/chrome/browser/download/download_manager_unittest.cc @@ -1,13 +1,19 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <string> +#include "base/string_util.h" +#include "build/build_config.h" #include "chrome/browser/download/download_manager.h" #include "chrome/browser/download/download_util.h" #include "testing/gtest/include/gtest/gtest.h" +#if defined(OS_LINUX) +#include <locale.h> +#endif + class DownloadManagerTest : public testing::Test { public: DownloadManagerTest() { @@ -455,6 +461,16 @@ const struct { // Tests to ensure that the file names we generate from hints from the server // (content-disposition, URL name, etc) don't cause security holes. TEST_F(DownloadManagerTest, TestDownloadFilename) { +#if defined(OS_LINUX) + // This test doesn't run when the locale is not UTF-8 becuase some of the + // string conversions fail. This is OK (we have the default value) but they + // don't match our expectations. + std::string locale = setlocale(LC_CTYPE, NULL); + StringToLowerASCII(&locale); + ASSERT_NE(std::string::npos, locale.find("utf-8")) + << "Your locale must be set to UTF-8 for this test to pass!"; +#endif + std::wstring file_name; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kGeneratedFiles); ++i) { GetGeneratedFilename(kGeneratedFiles[i].disposition, |