Index: test/GlobalJsObject.cpp |
=================================================================== |
--- a/test/GlobalJsObject.cpp |
+++ b/test/GlobalJsObject.cpp |
@@ -23,42 +23,42 @@ |
class GlobalJsObjectTest : public BaseJsTest |
{ |
}; |
} |
TEST_F(GlobalJsObjectTest, SetTimeout) |
{ |
jsEngine->Evaluate("setTimeout(function() {foo = 'bar';}, 100)"); |
- ASSERT_TRUE(jsEngine->Evaluate("this.foo")->IsUndefined()); |
+ ASSERT_TRUE(jsEngine->Evaluate("this.foo").IsUndefined()); |
AdblockPlus::Sleep(200); |
- ASSERT_EQ("bar", jsEngine->Evaluate("this.foo")->AsString()); |
+ ASSERT_EQ("bar", jsEngine->Evaluate("this.foo").AsString()); |
} |
TEST_F(GlobalJsObjectTest, SetTimeoutWithArgs) |
{ |
jsEngine->Evaluate("setTimeout(function(s) {foo = s;}, 100, 'foobar')"); |
- ASSERT_TRUE(jsEngine->Evaluate("this.foo")->IsUndefined()); |
+ ASSERT_TRUE(jsEngine->Evaluate("this.foo").IsUndefined()); |
AdblockPlus::Sleep(200); |
- ASSERT_EQ("foobar", jsEngine->Evaluate("this.foo")->AsString()); |
+ ASSERT_EQ("foobar", jsEngine->Evaluate("this.foo").AsString()); |
} |
TEST_F(GlobalJsObjectTest, SetTimeoutWithInvalidArgs) |
{ |
ASSERT_ANY_THROW(jsEngine->Evaluate("setTimeout()")); |
ASSERT_ANY_THROW(jsEngine->Evaluate("setTimeout('', 1)")); |
} |
TEST_F(GlobalJsObjectTest, SetMultipleTimeouts) |
{ |
jsEngine->Evaluate("foo = []"); |
jsEngine->Evaluate("setTimeout(function(s) {foo.push('1');}, 100)"); |
jsEngine->Evaluate("setTimeout(function(s) {foo.push('2');}, 150)"); |
AdblockPlus::Sleep(200); |
- ASSERT_EQ("1,2", jsEngine->Evaluate("this.foo")->AsString()); |
+ ASSERT_EQ("1,2", jsEngine->Evaluate("this.foo").AsString()); |
} |
TEST_F(GlobalJsObjectTest, TimeoutDoesNotKeepJsEngine) |
{ |
jsEngine->Evaluate("setTimeout(function() {}, 50000)"); |
EXPECT_EQ(1u, jsEngine.use_count()); // check that counter is still 1 |
AdblockPlus::Sleep(200); |
std::weak_ptr<AdblockPlus::JsEngine> weakJsEngine = jsEngine; |