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

Side by Side Diff: test/BaseJsTest.h

Issue 5163715573841920: Issue 768 - Switch from TR1 to C++11 (Closed)
Patch Set: fix including of <memory> Created Aug. 7, 2015, 6:07 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/JsEngine.cpp ('k') | test/ConsoleJsObject.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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-2015 Eyeo GmbH 3 * Copyright (C) 2006-2015 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 17 matching lines...) Expand all
28 void operator()(LogLevel logLevel, const std::string& message, 28 void operator()(LogLevel logLevel, const std::string& message,
29 const std::string& source) 29 const std::string& source)
30 { 30 {
31 throw std::runtime_error("Unexpected error: " + message); 31 throw std::runtime_error("Unexpected error: " + message);
32 } 32 }
33 }; 33 };
34 34
35 class ThrowingFileSystem : public AdblockPlus::FileSystem 35 class ThrowingFileSystem : public AdblockPlus::FileSystem
36 { 36 {
37 public: 37 public:
38 std::tr1::shared_ptr<std::istream> Read(const std::string& path) const 38 std::shared_ptr<std::istream> Read(const std::string& path) const
39 { 39 {
40 throw std::runtime_error("Not implemented"); 40 throw std::runtime_error("Not implemented");
41 } 41 }
42 42
43 void Write(const std::string& path, 43 void Write(const std::string& path, std::shared_ptr<std::istream> content)
44 std::tr1::shared_ptr<std::istream> content)
45 { 44 {
46 throw std::runtime_error("Not implemented"); 45 throw std::runtime_error("Not implemented");
47 } 46 }
48 47
49 void Move(const std::string& fromPath, const std::string& toPath) 48 void Move(const std::string& fromPath, const std::string& toPath)
50 { 49 {
51 throw std::runtime_error("Not implemented"); 50 throw std::runtime_error("Not implemented");
52 } 51 }
53 52
54 void Remove(const std::string& path) 53 void Remove(const std::string& path)
(...skipping 18 matching lines...) Expand all
73 public: 72 public:
74 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const 73 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const
75 { 74 {
76 throw std::runtime_error("Unexpected GET: " + url); 75 throw std::runtime_error("Unexpected GET: " + url);
77 } 76 }
78 }; 77 };
79 78
80 class LazyFileSystem : public AdblockPlus::FileSystem 79 class LazyFileSystem : public AdblockPlus::FileSystem
81 { 80 {
82 public: 81 public:
83 std::tr1::shared_ptr<std::istream> Read(const std::string& path) const 82 std::shared_ptr<std::istream> Read(const std::string& path) const
84 { 83 {
85 std::string dummyData(""); 84 std::string dummyData("");
86 if (path == "patterns.ini") 85 if (path == "patterns.ini")
87 dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~"; 86 dummyData = "# Adblock Plus preferences\n[Subscription]\nurl=~fl~";
88 else if (path == "prefs.json") 87 else if (path == "prefs.json")
89 dummyData = "{}"; 88 dummyData = "{}";
90 return std::tr1::shared_ptr<std::istream>(new std::istringstream(dummyData)) ; 89 return std::shared_ptr<std::istream>(new std::istringstream(dummyData));
91 } 90 }
92 91
93 void Write(const std::string& path, 92 void Write(const std::string& path, std::shared_ptr<std::istream> content)
94 std::tr1::shared_ptr<std::istream> content)
95 { 93 {
96 } 94 }
97 95
98 void Move(const std::string& fromPath, const std::string& toPath) 96 void Move(const std::string& fromPath, const std::string& toPath)
99 { 97 {
100 } 98 }
101 99
102 void Remove(const std::string& path) 100 void Remove(const std::string& path)
103 { 101 {
104 } 102 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 virtual void SetUp() 146 virtual void SetUp()
149 { 147 {
150 jsEngine = AdblockPlus::JsEngine::New(); 148 jsEngine = AdblockPlus::JsEngine::New();
151 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new ThrowingLogSystem)); 149 jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr(new ThrowingLogSystem));
152 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new ThrowingFileSystem)); 150 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new ThrowingFileSystem));
153 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new ThrowingWebRequest)); 151 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new ThrowingWebRequest));
154 } 152 }
155 }; 153 };
156 154
157 #endif 155 #endif
OLDNEW
« no previous file with comments | « src/JsEngine.cpp ('k') | test/ConsoleJsObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld