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

Side by Side Diff: test/ConsoleJsObject.cpp

Issue 10259001: XMLHttpRequest API (Closed)
Patch Set: Addressed review comments Created April 11, 2013, 4:30 p.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/WebRequestJsObject.cpp ('k') | test/FilterEngineStubs.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 #include <AdblockPlus.h> 1 #include <AdblockPlus.h>
2 #include <gtest/gtest.h> 2 #include <gtest/gtest.h>
3 3
4 class MockErrorCallback : public AdblockPlus::ErrorCallback 4 class MockErrorCallback : public AdblockPlus::ErrorCallback
5 { 5 {
6 public: 6 public:
7 std::string lastMessage; 7 std::string lastMessage;
8 8
9 void operator()(const std::string& message) 9 void operator()(const std::string& message)
10 { 10 {
11 lastMessage = message; 11 lastMessage = message;
12 } 12 }
13 }; 13 };
14 14
15 TEST(ConsoleJsObjectTest, ErrorInvokesErrorCallback) 15 TEST(ConsoleJsObjectTest, ErrorInvokesErrorCallback)
16 { 16 {
17 MockErrorCallback errorCallback; 17 MockErrorCallback errorCallback;
18 AdblockPlus::JsEngine jsEngine(0, &errorCallback); 18 AdblockPlus::JsEngine jsEngine(0, 0, &errorCallback);
19 jsEngine.Evaluate("console.error('foo')"); 19 jsEngine.Evaluate("console.error('foo')");
20 ASSERT_EQ("foo", errorCallback.lastMessage); 20 ASSERT_EQ("foo", errorCallback.lastMessage);
21 } 21 }
22 22
23 TEST(ConsoleJsObjectTest, TraceDoesNothing) 23 TEST(ConsoleJsObjectTest, TraceDoesNothing)
24 { 24 {
25 AdblockPlus::JsEngine jsEngine(0, 0); 25 AdblockPlus::JsEngine jsEngine(0, 0, 0);
26 jsEngine.Evaluate("console.trace()"); 26 jsEngine.Evaluate("console.trace()");
27 } 27 }
OLDNEW
« no previous file with comments | « src/WebRequestJsObject.cpp ('k') | test/FilterEngineStubs.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld