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

Delta Between Two Patch Sets: test/BaseJsTest.h

Issue 10369004: File system path resolving (Closed)
Left Patch Set: Comments addressed Created April 30, 2013, 8:09 a.m.
Right Patch Set: Addressing comments Created May 5, 2013, 10:49 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
LEFTRIGHT
1 #ifndef MOCKS_H 1 #ifndef MOCKS_H
2 #define MOCKS_H 2 #define MOCKS_H
3 3
4 #include <AdblockPlus.h> 4 #include <AdblockPlus.h>
5 #include <gtest/gtest.h> 5 #include <gtest/gtest.h>
6 #include "../src/Thread.h" 6 #include "../src/Thread.h"
7 7
8 class ThrowingErrorCallback : public AdblockPlus::ErrorCallback 8 class ThrowingErrorCallback : public AdblockPlus::ErrorCallback
9 { 9 {
10 public: 10 public:
(...skipping 25 matching lines...) Expand all
36 { 36 {
37 throw std::runtime_error("Not implemented"); 37 throw std::runtime_error("Not implemented");
38 } 38 }
39 39
40 StatResult Stat(const std::string& path) const 40 StatResult Stat(const std::string& path) const
41 { 41 {
42 throw std::runtime_error("Not implemented"); 42 throw std::runtime_error("Not implemented");
43 } 43 }
44 44
45 std::string Resolve(const std::string& path) const 45 std::string Resolve(const std::string& path) const
46 {
47 throw std::runtime_error("Not implemented");
48 }
49
50 void SetBasePath(const std::string& path)
51 { 46 {
52 throw std::runtime_error("Not implemented"); 47 throw std::runtime_error("Not implemented");
53 } 48 }
54 49
55 }; 50 };
56 51
57 class ThrowingWebRequest : public AdblockPlus::WebRequest 52 class ThrowingWebRequest : public AdblockPlus::WebRequest
58 { 53 {
59 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const 54 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const
60 { 55 {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 87
93 StatResult Stat(const std::string& path) const 88 StatResult Stat(const std::string& path) const
94 { 89 {
95 while (true) 90 while (true)
96 AdblockPlus::Sleep(100000); 91 AdblockPlus::Sleep(100000);
97 return StatResult(); 92 return StatResult();
98 } 93 }
99 94
100 std::string Resolve(const std::string& path) const 95 std::string Resolve(const std::string& path) const
101 { 96 {
102 while (true)
103 AdblockPlus::Sleep(100000);
104 return std::string(); 97 return std::string();
105 }
106
107 void SetBasePath(const std::string& path)
108 {
109 while (true)
110 AdblockPlus::Sleep(100000);
Wladimir Palant 2013/04/30 09:29:50 SetBasePath() isn't a function called from JS, no
111 } 98 }
112 }; 99 };
113 100
114 class LazyWebRequest : public AdblockPlus::WebRequest 101 class LazyWebRequest : public AdblockPlus::WebRequest
115 { 102 {
116 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const 103 AdblockPlus::ServerResponse GET(const std::string& url, const AdblockPlus::Hea derList& requestHeaders) const
117 { 104 {
118 while (true) 105 while (true)
119 AdblockPlus::Sleep(100000); 106 AdblockPlus::Sleep(100000);
120 return AdblockPlus::ServerResponse(); 107 return AdblockPlus::ServerResponse();
121 } 108 }
122 }; 109 };
123 110
124 111
125 class BaseJsTest : public ::testing::Test 112 class BaseJsTest : public ::testing::Test
126 { 113 {
127 protected: 114 protected:
128 AdblockPlus::JsEnginePtr jsEngine; 115 AdblockPlus::JsEnginePtr jsEngine;
129 116
130 virtual void SetUp() 117 virtual void SetUp()
131 { 118 {
132 jsEngine = AdblockPlus::JsEngine::New(); 119 jsEngine = AdblockPlus::JsEngine::New();
133 jsEngine->SetErrorCallback(AdblockPlus::ErrorCallbackPtr(new ThrowingErrorCa llback)); 120 jsEngine->SetErrorCallback(AdblockPlus::ErrorCallbackPtr(new ThrowingErrorCa llback));
134 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new ThrowingFileSystem)); 121 jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr(new ThrowingFileSystem));
135 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new ThrowingWebRequest)); 122 jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr(new ThrowingWebRequest));
136 } 123 }
137 }; 124 };
138 125
139 #endif 126 #endif
LEFTRIGHT

Powered by Google App Engine
This is Rietveld