| OLD | NEW |
| 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-2017 eyeo GmbH | 3 * Copyright (C) 2006-2017 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 |
| 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
| 13 * | 13 * |
| 14 * You should have received a copy of the GNU General Public License | 14 * You should have received a copy of the GNU General Public License |
| 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. | 15 * along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. |
| 16 */ | 16 */ |
| 17 | 17 |
| 18 #include <sstream> | 18 #include <sstream> |
| 19 #include <AdblockPlus.h> | 19 #include <AdblockPlus.h> |
| 20 #include <gtest/gtest.h> | 20 #include <gtest/gtest.h> |
| 21 | 21 |
| 22 namespace | 22 namespace |
| 23 { | 23 { |
| 24 const std::string testPath = "libadblockplus-t\xc3\xa4st-file"; | 24 const std::string testPath = "libadblockplus-t\xc3\xa4st-file"; |
| 25 | 25 |
| 26 void WriteString(AdblockPlus::FileSystem& fileSystem, | 26 void WriteString(AdblockPlus::FileSystem& fileSystem, |
| 27 const std::string& content) | 27 const std::string& content) |
| 28 { | 28 { |
| 29 std::shared_ptr<std::stringstream> input(new std::stringstream); | 29 std::stringstream input; |
| 30 *input << content; | 30 input << content; |
| 31 fileSystem.Write(testPath, input); | 31 fileSystem.Write(testPath, input); |
| 32 } | 32 } |
| 33 } | 33 } |
| 34 | 34 |
| 35 TEST(DefaultFileSystemTest, WriteReadRemove) | 35 TEST(DefaultFileSystemTest, WriteReadRemove) |
| 36 { | 36 { |
| 37 AdblockPlus::DefaultFileSystem fileSystem; | 37 AdblockPlus::DefaultFileSystem fileSystem; |
| 38 WriteString(fileSystem, "foo"); | 38 WriteString(fileSystem, "foo"); |
| 39 std::stringstream output; | 39 std::stringstream output; |
| 40 output << fileSystem.Read(testPath)->rdbuf(); | 40 output << fileSystem.Read(testPath)->rdbuf(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 64 const std::string newTestPath = testPath + "-new"; | 64 const std::string newTestPath = testPath + "-new"; |
| 65 fileSystem.Move(testPath, newTestPath); | 65 fileSystem.Move(testPath, newTestPath); |
| 66 result = fileSystem.Stat(testPath); | 66 result = fileSystem.Stat(testPath); |
| 67 ASSERT_FALSE(result.exists); | 67 ASSERT_FALSE(result.exists); |
| 68 result = fileSystem.Stat(newTestPath); | 68 result = fileSystem.Stat(newTestPath); |
| 69 ASSERT_TRUE(result.exists); | 69 ASSERT_TRUE(result.exists); |
| 70 fileSystem.Remove(newTestPath); | 70 fileSystem.Remove(newTestPath); |
| 71 result = fileSystem.Stat(newTestPath); | 71 result = fileSystem.Stat(newTestPath); |
| 72 ASSERT_FALSE(result.exists); | 72 ASSERT_FALSE(result.exists); |
| 73 } | 73 } |
| OLD | NEW |