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

Side by Side Diff: chrome/browser/safe_browsing/path_sanitizer_unittest.cc

Issue 323953002: Support for recording registered LSPs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@grt
Patch Set: Addressing comments Created 6 years, 6 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/safe_browsing/path_sanitizer.h"
6
7 #include "testing/gtest/include/gtest/gtest.h"
8
9 TEST(SafeBrowsingPathSanitizerTest, HomeDirectoryIsNotEmpty) {
10 safe_browsing::PathSanitizer path_sanitizer;
11
12 ASSERT_FALSE(path_sanitizer.GetHomeDirectory().empty());
13 }
14
15 TEST(SafeBrowsingPathSanitizerTest, DontStripHomeDirectoryTest) {
16 // Test with path not in home directory
17 safe_browsing::PathSanitizer path_sanitizer;
18
19 base::FilePath path(
20 FILE_PATH_LITERAL("C:\\path\\not\\in\\home\\directory\\test.dll"));
mattm 2014/06/17 17:55:52 These tests probably still need some work for non-
pmonette_google.com 2014/06/18 15:34:19 I made them portable.
21
22 path_sanitizer.StripHomeDirectory(&path);
23
24 ASSERT_EQ(path.value(),
25 FILE_PATH_LITERAL("C:\\path\\not\\in\\home\\directory\\test.dll"));
26 }
27
28 TEST(SafeBrowsingPathSanitizerTest, DoStripHomeDirectoryTest) {
29 // Test with path in home directory
30 safe_browsing::PathSanitizer path_sanitizer;
31
32 base::FilePath path = path_sanitizer.GetHomeDirectory().Append(
33 FILE_PATH_LITERAL("path\\in\\home\\directory\\test.dll"));
34
35 path_sanitizer.StripHomeDirectory(&path);
36
37 ASSERT_EQ(path.value(),
38 FILE_PATH_LITERAL("~\\path\\in\\home\\directory\\test.dll"));
39 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698