| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 2  * This file is part of Adblock Plus <https://adblockplus.org/>, | 
| 3  * Copyright (C) 2006-2015 Eyeo GmbH | 3  * Copyright (C) 2006-2015 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 125   std::string platformVersion = jsEngine->Evaluate("require('info').platformVers
     ion")->AsString(); | 125   std::string platformVersion = jsEngine->Evaluate("require('info').platformVers
     ion")->AsString(); | 
| 126 | 126 | 
| 127   FindAndReplace(expectedUrl, "%NAME%", appInfo.name); | 127   FindAndReplace(expectedUrl, "%NAME%", appInfo.name); | 
| 128   FindAndReplace(expectedUrl, "%TYPE%", "1");   // manual update | 128   FindAndReplace(expectedUrl, "%TYPE%", "1");   // manual update | 
| 129   expectedUrl += "&addonName=" + appInfo.name + | 129   expectedUrl += "&addonName=" + appInfo.name + | 
| 130                  "&addonVersion=" + appInfo.version + | 130                  "&addonVersion=" + appInfo.version + | 
| 131                  "&application=" + appInfo.application + | 131                  "&application=" + appInfo.application + | 
| 132                  "&applicationVersion=" + appInfo.applicationVersion + | 132                  "&applicationVersion=" + appInfo.applicationVersion + | 
| 133                  "&platform=" + platform + | 133                  "&platform=" + platform + | 
| 134                  "&platformVersion=" + platformVersion + | 134                  "&platformVersion=" + platformVersion + | 
| 135                  "&lastVersion=0"; | 135                  "&lastVersion=0&downloadCount=0"; | 
| 136   ASSERT_EQ(expectedUrl, previousRequestUrl); | 136   ASSERT_EQ(expectedUrl, previousRequestUrl); | 
| 137 } | 137 } | 
| 138 | 138 | 
| 139 TEST_F(UpdateCheckTest, UpdateAvailable) | 139 TEST_F(UpdateCheckTest, UpdateAvailable) | 
| 140 { | 140 { | 
| 141   webRequest->response.status = AdblockPlus::WebRequest::NS_OK; | 141   webRequest->response.status = AdblockPlus::WebRequest::NS_OK; | 
| 142   webRequest->response.responseStatus = 200; | 142   webRequest->response.responseStatus = 200; | 
| 143   webRequest->response.responseText = "{\"1\": {\"version\":\"3.1\",\"url\":\"ht
     tps://foo.bar/\"}}"; | 143   webRequest->response.responseText = "{\"1\": {\"version\":\"3.1\",\"url\":\"ht
     tps://foo.bar/\"}}"; | 
| 144 | 144 | 
| 145   appInfo.name = "1"; | 145   appInfo.name = "1"; | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 165   std::string platformVersion = jsEngine->Evaluate("require('info').platformVers
     ion")->AsString(); | 165   std::string platformVersion = jsEngine->Evaluate("require('info').platformVers
     ion")->AsString(); | 
| 166 | 166 | 
| 167   FindAndReplace(expectedUrl, "%NAME%", appInfo.name); | 167   FindAndReplace(expectedUrl, "%NAME%", appInfo.name); | 
| 168   FindAndReplace(expectedUrl, "%TYPE%", "1");   // manual update | 168   FindAndReplace(expectedUrl, "%TYPE%", "1");   // manual update | 
| 169   expectedUrl += "&addonName=" + appInfo.name + | 169   expectedUrl += "&addonName=" + appInfo.name + | 
| 170                  "&addonVersion=" + appInfo.version + | 170                  "&addonVersion=" + appInfo.version + | 
| 171                  "&application=" + appInfo.application + | 171                  "&application=" + appInfo.application + | 
| 172                  "&applicationVersion=" + appInfo.applicationVersion + | 172                  "&applicationVersion=" + appInfo.applicationVersion + | 
| 173                  "&platform=" + platform + | 173                  "&platform=" + platform + | 
| 174                  "&platformVersion=" + platformVersion + | 174                  "&platformVersion=" + platformVersion + | 
| 175                  "&lastVersion=0"; | 175                  "&lastVersion=0&downloadCount=0"; | 
| 176   ASSERT_EQ(expectedUrl, previousRequestUrl); | 176   ASSERT_EQ(expectedUrl, previousRequestUrl); | 
| 177 } | 177 } | 
| 178 | 178 | 
| 179 TEST_F(UpdateCheckTest, ApplicationUpdateAvailable) | 179 TEST_F(UpdateCheckTest, ApplicationUpdateAvailable) | 
| 180 { | 180 { | 
| 181   webRequest->response.status = AdblockPlus::WebRequest::NS_OK; | 181   webRequest->response.status = AdblockPlus::WebRequest::NS_OK; | 
| 182   webRequest->response.responseStatus = 200; | 182   webRequest->response.responseStatus = 200; | 
| 183   webRequest->response.responseText = "{\"1/4\": {\"version\":\"3.1\",\"url\":\"
     https://foo.bar/\"}}"; | 183   webRequest->response.responseText = "{\"1/4\": {\"version\":\"3.1\",\"url\":\"
     https://foo.bar/\"}}"; | 
| 184 | 184 | 
| 185   appInfo.name = "1"; | 185   appInfo.name = "1"; | 
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 262 | 262 | 
| 263   Reset(); | 263   Reset(); | 
| 264   ForceUpdateCheck(); | 264   ForceUpdateCheck(); | 
| 265 | 265 | 
| 266   AdblockPlus::Sleep(100); | 266   AdblockPlus::Sleep(100); | 
| 267 | 267 | 
| 268   ASSERT_FALSE(eventCallbackCalled); | 268   ASSERT_FALSE(eventCallbackCalled); | 
| 269   ASSERT_TRUE(updateCallbackCalled); | 269   ASSERT_TRUE(updateCallbackCalled); | 
| 270   ASSERT_FALSE(updateError.empty()); | 270   ASSERT_FALSE(updateError.empty()); | 
| 271 } | 271 } | 
| OLD | NEW | 
|---|