Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4200)

Unified Diff: chrome/browser/download/download_manager_unittest.cc

Issue 243102: Convert base dependencies to use sys_string_conversions instead of the ICU... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/values.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/download/download_manager_unittest.cc
===================================================================
--- chrome/browser/download/download_manager_unittest.cc (revision 28166)
+++ chrome/browser/download/download_manager_unittest.cc (working copy)
@@ -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 @@
// 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,
« no previous file with comments | « base/values.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698