Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: test/DefaultFileSystem.cpp

Issue 29538640: Issue 5610 - Deal with a '/' base path (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Left Patch Set: Created Sept. 7, 2017, 4:31 p.m.
Right Patch Set: Changes from review Created Sept. 8, 2017, 1:09 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/DefaultFileSystem.cpp ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 /* 1 /*
2 * This file is part of Adblock Plus <https://adblockplus.org/>, 2 * This file is part of Adblock Plus <https://adblockplus.org/>,
3 * Copyright (C) 2006-present eyeo GmbH 3 * Copyright (C) 2006-present eyeo GmbH
4 * 4 *
5 * Adblock Plus is free software: you can redistribute it and/or modify 5 * Adblock Plus is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 3 as 6 * it under the terms of the GNU General Public License version 3 as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
8 * 8 *
9 * Adblock Plus is distributed in the hope that it will be useful, 9 * Adblock Plus is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
(...skipping 18 matching lines...) Expand all
29 using namespace AdblockPlus; 29 using namespace AdblockPlus;
30 namespace 30 namespace
31 { 31 {
32 const std::string testFileName = "libadblockplus-t\xc3\xa4st-file"; 32 const std::string testFileName = "libadblockplus-t\xc3\xa4st-file";
33 33
34 FileSystemPtr CreateDefaultFileSystem(const Scheduler& scheduler) 34 FileSystemPtr CreateDefaultFileSystem(const Scheduler& scheduler)
35 { 35 {
36 return FileSystemPtr(new DefaultFileSystem(scheduler, std::unique_ptr<Defaul tFileSystemSync>(new DefaultFileSystemSync("")))); 36 return FileSystemPtr(new DefaultFileSystem(scheduler, std::unique_ptr<Defaul tFileSystemSync>(new DefaultFileSystemSync(""))));
37 } 37 }
38 38
39 class BasePathTest : public ::testing::Test
sergei 2017/09/08 08:11:40 It seems this fixture is not required, one can sim
hub 2017/09/08 13:10:26 Done.
40 {
41 };
42
43 class DefaultFileSystemTest : public ::testing::Test 39 class DefaultFileSystemTest : public ::testing::Test
44 { 40 {
45 public: 41 public:
46 void SetUp() override 42 void SetUp() override
47 { 43 {
48 fileSystem = CreateDefaultFileSystem([this](const SchedulerTask& task) 44 fileSystem = CreateDefaultFileSystem([this](const SchedulerTask& task)
49 { 45 {
50 fileSystemTasks.emplace_back(task); 46 fileSystemTasks.emplace_back(task);
51 }); 47 });
52 } 48 }
(...skipping 21 matching lines...) Expand all
74 } 70 }
75 71
76 std::list<SchedulerTask> fileSystemTasks; 72 std::list<SchedulerTask> fileSystemTasks;
77 FileSystemPtr fileSystem; 73 FileSystemPtr fileSystem;
78 }; 74 };
79 } 75 }
80 76
81 #ifdef _WIN32 77 #ifdef _WIN32
82 #define SLASH_STRING "\\" 78 #define SLASH_STRING "\\"
83 #else 79 #else
84 #define SLASH_STRING "/" 80 #define SLASH_STRING "/"
sergei 2017/09/08 08:11:40 These defines are already available as PATH_SEPARA
hub 2017/09/08 13:10:26 but they are single char, while this is a string.
sergei 2017/09/08 13:20:18 Acknowledged.
85 #endif 81 #endif
86 82
87 83 TEST(DefaultFileSystemBasePathTest, BasePathAndResolveTest)
88 TEST_F(BasePathTest, BasePathTest)
sergei 2017/09/08 08:11:40 What about renaming it into something emphasizing
hub 2017/09/08 13:10:26 Done.
89 { 84 {
90 class TestFSSync : public DefaultFileSystemSync 85 class TestFSSync : public DefaultFileSystemSync
91 { 86 {
92 public: 87 public:
93 explicit TestFSSync(const std::string& basePath) 88 explicit TestFSSync(const std::string& basePath)
94 : DefaultFileSystemSync(basePath) 89 : DefaultFileSystemSync(basePath)
95 { 90 {
96 } 91 }
97 const std::string& base() const 92 const std::string& base() const
98 { 93 {
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 fileSystem->Stat(newTestFileName, [&hasStatRemovedFileRun](const IFileSystem:: StatResult& result, const std::string& error) 232 fileSystem->Stat(newTestFileName, [&hasStatRemovedFileRun](const IFileSystem:: StatResult& result, const std::string& error)
238 { 233 {
239 EXPECT_TRUE(error.empty()); 234 EXPECT_TRUE(error.empty());
240 ASSERT_FALSE(result.exists); 235 ASSERT_FALSE(result.exists);
241 hasStatRemovedFileRun = true; 236 hasStatRemovedFileRun = true;
242 }); 237 });
243 EXPECT_FALSE(hasStatRemovedFileRun); 238 EXPECT_FALSE(hasStatRemovedFileRun);
244 PumpTask(); 239 PumpTask();
245 EXPECT_TRUE(hasStatRemovedFileRun); 240 EXPECT_TRUE(hasStatRemovedFileRun);
246 } 241 }
LEFTRIGHT

Powered by Google App Engine
This is Rietveld