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

Unified Diff: components/resource_provider/file_utils_unittest.cc

Issue 1113223003: Revert of Adds resource_provider::ResourceProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 | « components/resource_provider/file_utils.cc ('k') | components/resource_provider/main.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/resource_provider/file_utils_unittest.cc
diff --git a/components/resource_provider/file_utils_unittest.cc b/components/resource_provider/file_utils_unittest.cc
deleted file mode 100644
index 96de984df38aae37c2584a60728c1d4c74ba5fc7..0000000000000000000000000000000000000000
--- a/components/resource_provider/file_utils_unittest.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright 2015 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 "components/resource_provider/file_utils.h"
-
-#include "base/files/file_path.h"
-#include "base/path_service.h"
-#include "base/strings/string_util.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "url/gurl.h"
-
-namespace resource_provider {
-
-// Assertions for invalid app paths.
-TEST(FileUtilsTest, InvalidAppPath) {
- struct TestCase {
- std::string url;
- };
- struct TestCase invalid_cases[]{
- {"http://foo"}, // Must start with 'mojo:'.
- {"mojo://."}, // Don't allow '.'.
- {"mojo://.."}, // Don't allow '..'.
- {"mojo://foo/."}, // Don't allow '.'.
- {"mojo://bar/.."}, // Don't allow '..'.
- };
-
- for (size_t i = 0; i < arraysize(invalid_cases); ++i) {
- const GURL url(invalid_cases[i].url);
- base::FilePath resulting_path(GetPathForApplicationUrl(url));
- EXPECT_TRUE(resulting_path.empty()) << "i=" << i
- << " input=" << invalid_cases[i].url
- << " result=" << resulting_path.value();
- }
-}
-
-// Assertions for invalid app paths.
-TEST(FileUtilsTest, InvalidResourcePath) {
- struct TestCase {
- std::string path;
- };
- struct TestCase invalid_cases[]{
- {"."},
- {".."},
- {"foo/."},
- {"bar/.."},
- {"foo/./bar"},
- {"bar/../baz"},
- {"bar/baz/"},
- {"bar//baz/"},
- };
-
- const base::FilePath app_path(GetPathForApplicationUrl(GURL("mojo:test")));
- ASSERT_FALSE(app_path.empty());
-
- for (size_t i = 0; i < arraysize(invalid_cases); ++i) {
- base::FilePath resulting_path(
- GetPathForResourceNamed(app_path, invalid_cases[i].path));
- EXPECT_TRUE(resulting_path.empty()) << i
- << " input=" << invalid_cases[i].path
- << " result=" << resulting_path.value();
- }
-}
-
-TEST(FileUtilsTest, ValidPaths) {
- const base::FilePath app_path(GetPathForApplicationUrl(GURL("mojo:test")));
- ASSERT_FALSE(app_path.empty());
-
- // Trivial single path element.
- const base::FilePath trivial_path(
- GetPathForResourceNamed(app_path, "single"));
- EXPECT_EQ(app_path.AppendASCII("single").value(), trivial_path.value());
-
- // Two path elements.
- const base::FilePath two_paths(GetPathForResourceNamed(app_path, "a/b"));
- EXPECT_EQ(app_path.AppendASCII("a").AppendASCII("b").value(),
- two_paths.value());
-}
-
-} // namespace resource_provider
« no previous file with comments | « components/resource_provider/file_utils.cc ('k') | components/resource_provider/main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698