blob: 88705dbb45d216d864f93af6bd578d3610e7941e [file] [log] [blame]
// Copyright 2019 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 "pdf/out_of_process_instance.h"
#include <string>
#include "testing/gtest/include/gtest/gtest.h"
namespace chrome_pdf {
TEST(OutOfProcessInstanceTest, GetFileNameFromUrl) {
// File extensions should be kept as-is.
// Most escaped characters should be unescaped.
EXPECT_EQ("a b.pdf", OutOfProcessInstance::GetFileNameFromUrl(
// Escaped file path delimiters and control codes should be replaced by a
// placeholder.
EXPECT_EQ("a_b_.pdf", OutOfProcessInstance::GetFileNameFromUrl(
// UTF-8 characters, including ones left escaped by UnescapeURLComponent() for
// security reasons, are allowed in file paths.
EXPECT_EQ("\xF0\x9F\x94\x92", OutOfProcessInstance::GetFileNameFromUrl(
} // namespace chrome_pdf