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

Unified Diff: test/FileSystemJsObject.cpp

Issue 10198022: Pass application data into libadblockplus (Closed)
Patch Set: Merged upstream, addressed issues, renamed AppInfo fields Created April 17, 2013, 2:47 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: test/FileSystemJsObject.cpp
===================================================================
--- a/test/FileSystemJsObject.cpp
+++ b/test/FileSystemJsObject.cpp
@@ -87,7 +87,7 @@
{
MockFileSystem fileSystem;
fileSystem.contentToRead = "foo";
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
std::string content;
std::string error;
ReadFile(jsEngine, content, error);
@@ -97,7 +97,7 @@
TEST(FileSystemJsObjectTest, ReadIllegalArguments)
{
- AdblockPlus::JsEngine jsEngine(0, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), 0, 0, 0);
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.read()"));
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.read('', '')"));
}
@@ -106,7 +106,7 @@
{
MockFileSystem fileSystem;
fileSystem.success = false;
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
std::string content;
std::string error;
ReadFile(jsEngine, content, error);
@@ -117,7 +117,7 @@
TEST(FileSystemJsObjectTest, Write)
{
MockFileSystem fileSystem;
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
jsEngine.Evaluate("_fileSystem.write('foo', 'bar', function(e) {error = e})");
AdblockPlus::Sleep(10);
ASSERT_EQ("foo", fileSystem.lastWrittenPath);
@@ -127,7 +127,7 @@
TEST(FileSystemJsObjectTest, WriteIllegalArguments)
{
- AdblockPlus::JsEngine jsEngine(0, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), 0, 0, 0);
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.write()"));
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.write('', '', '')"));
}
@@ -136,7 +136,7 @@
{
MockFileSystem fileSystem;
fileSystem.success = false;
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
jsEngine.Evaluate("_fileSystem.write('foo', 'bar', function(e) {error = e})");
AdblockPlus::Sleep(10);
ASSERT_NE("", jsEngine.Evaluate("error")->AsString());
@@ -145,7 +145,7 @@
TEST(FileSystemJsObjectTest, Move)
{
MockFileSystem fileSystem;
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
jsEngine.Evaluate("_fileSystem.move('foo', 'bar', function(e) {error = e})");
AdblockPlus::Sleep(10);
ASSERT_EQ("foo", fileSystem.movedFrom);
@@ -155,7 +155,7 @@
TEST(FileSystemJsObjectTest, MoveIllegalArguments)
{
- AdblockPlus::JsEngine jsEngine(0, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), 0, 0, 0);
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.move()"));
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.move('', '', '')"));
}
@@ -164,7 +164,7 @@
{
MockFileSystem fileSystem;
fileSystem.success = false;
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
jsEngine.Evaluate("_fileSystem.move('foo', 'bar', function(e) {error = e})");
AdblockPlus::Sleep(10);
ASSERT_NE("", jsEngine.Evaluate("error")->AsString());
@@ -173,7 +173,7 @@
TEST(FileSystemJsObjectTest, Remove)
{
MockFileSystem fileSystem;
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
jsEngine.Evaluate("_fileSystem.remove('foo', function(e) {error = e})");
AdblockPlus::Sleep(10);
ASSERT_EQ("foo", fileSystem.removedPath);
@@ -182,7 +182,7 @@
TEST(FileSystemJsObjectTest, RemoveIllegalArguments)
{
- AdblockPlus::JsEngine jsEngine(0, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), 0, 0, 0);
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.remove()"));
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.remove('', '')"));
}
@@ -191,7 +191,7 @@
{
MockFileSystem fileSystem;
fileSystem.success = false;
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
jsEngine.Evaluate("_fileSystem.remove('foo', function(e) {error = e})");
AdblockPlus::Sleep(10);
ASSERT_NE("", jsEngine.Evaluate("error")->AsString());
@@ -204,7 +204,7 @@
fileSystem.statIsDirectory= false;
fileSystem.statIsFile = true;
fileSystem.statLastModified = 1337;
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
jsEngine.Evaluate("_fileSystem.stat('foo', function(r) {result = r})");
AdblockPlus::Sleep(10);
ASSERT_EQ("foo", fileSystem.statPath);
@@ -217,7 +217,7 @@
TEST(FileSystemJsObjectTest, StatIllegalArguments)
{
- AdblockPlus::JsEngine jsEngine(0, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), 0, 0, 0);
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.stat()"));
ASSERT_ANY_THROW(jsEngine.Evaluate("_fileSystem.stat('', '')"));
}
@@ -226,7 +226,7 @@
{
MockFileSystem fileSystem;
fileSystem.success = false;
- AdblockPlus::JsEngine jsEngine(&fileSystem, 0, 0);
+ AdblockPlus::JsEngine jsEngine(AdblockPlus::AppInfo(), &fileSystem, 0, 0);
jsEngine.Evaluate("_fileSystem.stat('foo', function(r) {result = r})");
AdblockPlus::Sleep(10);
ASSERT_NE("", jsEngine.Evaluate("result.error")->AsString());

Powered by Google App Engine
This is Rietveld