OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <http://adblockplus.org/>, | 2 * This file is part of Adblock Plus <http://adblockplus.org/>, |
3 * Copyright (C) 2006-2013 Eyeo GmbH | 3 * Copyright (C) 2006-2013 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 | 60 |
61 value = jsEngine->NewObject(); | 61 value = jsEngine->NewObject(); |
62 ASSERT_TRUE(value->IsObject()); | 62 ASSERT_TRUE(value->IsObject()); |
63 ASSERT_EQ(0u, value->GetOwnPropertyNames().size()); | 63 ASSERT_EQ(0u, value->GetOwnPropertyNames().size()); |
64 } | 64 } |
65 | 65 |
66 TEST(NewJsEngineTest, CallbackGetSet) | 66 TEST(NewJsEngineTest, CallbackGetSet) |
67 { | 67 { |
68 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New()); | 68 AdblockPlus::JsEnginePtr jsEngine(AdblockPlus::JsEngine::New()); |
69 | 69 |
70 ASSERT_TRUE(jsEngine->GetErrorCallback()); | 70 ASSERT_TRUE(jsEngine->GetLogSystem()); |
71 ASSERT_ANY_THROW(jsEngine->SetErrorCallback(AdblockPlus::ErrorCallbackPtr())); | 71 ASSERT_ANY_THROW(jsEngine->SetLogSystem(AdblockPlus::LogSystemPtr())); |
72 AdblockPlus::ErrorCallbackPtr errorCallback(new AdblockPlus::DefaultErrorCallb
ack()); | 72 AdblockPlus::LogSystemPtr logSystem(new AdblockPlus::DefaultLogSystem()); |
73 jsEngine->SetErrorCallback(errorCallback); | 73 jsEngine->SetLogSystem(logSystem); |
74 ASSERT_EQ(errorCallback, jsEngine->GetErrorCallback()); | 74 ASSERT_EQ(logSystem, jsEngine->GetLogSystem()); |
75 | 75 |
76 ASSERT_TRUE(jsEngine->GetFileSystem()); | 76 ASSERT_TRUE(jsEngine->GetFileSystem()); |
77 ASSERT_ANY_THROW(jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr())); | 77 ASSERT_ANY_THROW(jsEngine->SetFileSystem(AdblockPlus::FileSystemPtr())); |
78 AdblockPlus::FileSystemPtr fileSystem(new AdblockPlus::DefaultFileSystem()); | 78 AdblockPlus::FileSystemPtr fileSystem(new AdblockPlus::DefaultFileSystem()); |
79 jsEngine->SetFileSystem(fileSystem); | 79 jsEngine->SetFileSystem(fileSystem); |
80 ASSERT_EQ(fileSystem, jsEngine->GetFileSystem()); | 80 ASSERT_EQ(fileSystem, jsEngine->GetFileSystem()); |
81 | 81 |
82 ASSERT_TRUE(jsEngine->GetWebRequest()); | 82 ASSERT_TRUE(jsEngine->GetWebRequest()); |
83 ASSERT_ANY_THROW(jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr())); | 83 ASSERT_ANY_THROW(jsEngine->SetWebRequest(AdblockPlus::WebRequestPtr())); |
84 AdblockPlus::WebRequestPtr webRequest(new AdblockPlus::DefaultWebRequest()); | 84 AdblockPlus::WebRequestPtr webRequest(new AdblockPlus::DefaultWebRequest()); |
85 jsEngine->SetWebRequest(webRequest); | 85 jsEngine->SetWebRequest(webRequest); |
86 ASSERT_EQ(webRequest, jsEngine->GetWebRequest()); | 86 ASSERT_EQ(webRequest, jsEngine->GetWebRequest()); |
87 } | 87 } |
OLD | NEW |