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

Side by Side Diff: test/UpdateCheck.cpp

Issue 29417624: Issue 5034 - Part 4: JsEngine::Evaluate() return a JsValue (Closed) Base URL: https://hg.adblockplus.org/libadblockplus/
Patch Set: Rebased on top of part 3 Created April 20, 2017, 12:41 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 | « test/JsValue.cpp ('k') | test/WebRequest.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 /* 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-2017 eyeo GmbH 3 * Copyright (C) 2006-2017 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 Reset(); 113 Reset();
114 ForceUpdateCheck(); 114 ForceUpdateCheck();
115 115
116 AdblockPlus::Sleep(100); 116 AdblockPlus::Sleep(100);
117 117
118 ASSERT_FALSE(eventCallbackCalled); 118 ASSERT_FALSE(eventCallbackCalled);
119 ASSERT_TRUE(updateCallbackCalled); 119 ASSERT_TRUE(updateCallbackCalled);
120 ASSERT_FALSE(updateError.empty()); 120 ASSERT_FALSE(updateError.empty());
121 121
122 std::string expectedUrl(filterEngine->GetPref("update_url_release").AsString() ); 122 std::string expectedUrl(filterEngine->GetPref("update_url_release").AsString() );
123 std::string platform = jsEngine->Evaluate("require('info').platform")->AsStrin g(); 123 std::string platform = jsEngine->Evaluate("require('info').platform").AsString ();
124 std::string platformVersion = jsEngine->Evaluate("require('info').platformVers ion")->AsString(); 124 std::string platformVersion = jsEngine->Evaluate("require('info').platformVers ion").AsString();
125 125
126 FindAndReplace(expectedUrl, "%NAME%", appInfo.name); 126 FindAndReplace(expectedUrl, "%NAME%", appInfo.name);
127 FindAndReplace(expectedUrl, "%TYPE%", "1"); // manual update 127 FindAndReplace(expectedUrl, "%TYPE%", "1"); // manual update
128 expectedUrl += "&addonName=" + appInfo.name + 128 expectedUrl += "&addonName=" + appInfo.name +
129 "&addonVersion=" + appInfo.version + 129 "&addonVersion=" + appInfo.version +
130 "&application=" + appInfo.application + 130 "&application=" + appInfo.application +
131 "&applicationVersion=" + appInfo.applicationVersion + 131 "&applicationVersion=" + appInfo.applicationVersion +
132 "&platform=" + platform + 132 "&platform=" + platform +
133 "&platformVersion=" + platformVersion + 133 "&platformVersion=" + platformVersion +
134 "&lastVersion=0&downloadCount=0"; 134 "&lastVersion=0&downloadCount=0";
(...skipping 17 matching lines...) Expand all
152 152
153 AdblockPlus::Sleep(100); 153 AdblockPlus::Sleep(100);
154 154
155 ASSERT_TRUE(eventCallbackCalled); 155 ASSERT_TRUE(eventCallbackCalled);
156 ASSERT_EQ(1u, eventCallbackParams.size()); 156 ASSERT_EQ(1u, eventCallbackParams.size());
157 ASSERT_EQ("https://foo.bar/", eventCallbackParams[0].AsString()); 157 ASSERT_EQ("https://foo.bar/", eventCallbackParams[0].AsString());
158 ASSERT_TRUE(updateCallbackCalled); 158 ASSERT_TRUE(updateCallbackCalled);
159 ASSERT_TRUE(updateError.empty()); 159 ASSERT_TRUE(updateError.empty());
160 160
161 std::string expectedUrl(filterEngine->GetPref("update_url_devbuild").AsString( )); 161 std::string expectedUrl(filterEngine->GetPref("update_url_devbuild").AsString( ));
162 std::string platform = jsEngine->Evaluate("require('info').platform")->AsStrin g(); 162 std::string platform = jsEngine->Evaluate("require('info').platform").AsString ();
163 std::string platformVersion = jsEngine->Evaluate("require('info').platformVers ion")->AsString(); 163 std::string platformVersion = jsEngine->Evaluate("require('info').platformVers ion").AsString();
164 164
165 FindAndReplace(expectedUrl, "%NAME%", appInfo.name); 165 FindAndReplace(expectedUrl, "%NAME%", appInfo.name);
166 FindAndReplace(expectedUrl, "%TYPE%", "1"); // manual update 166 FindAndReplace(expectedUrl, "%TYPE%", "1"); // manual update
167 expectedUrl += "&addonName=" + appInfo.name + 167 expectedUrl += "&addonName=" + appInfo.name +
168 "&addonVersion=" + appInfo.version + 168 "&addonVersion=" + appInfo.version +
169 "&application=" + appInfo.application + 169 "&application=" + appInfo.application +
170 "&applicationVersion=" + appInfo.applicationVersion + 170 "&applicationVersion=" + appInfo.applicationVersion +
171 "&platform=" + platform + 171 "&platform=" + platform +
172 "&platformVersion=" + platformVersion + 172 "&platformVersion=" + platformVersion +
173 "&lastVersion=0&downloadCount=0"; 173 "&lastVersion=0&downloadCount=0";
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 256
257 Reset(); 257 Reset();
258 ForceUpdateCheck(); 258 ForceUpdateCheck();
259 259
260 AdblockPlus::Sleep(100); 260 AdblockPlus::Sleep(100);
261 261
262 ASSERT_FALSE(eventCallbackCalled); 262 ASSERT_FALSE(eventCallbackCalled);
263 ASSERT_TRUE(updateCallbackCalled); 263 ASSERT_TRUE(updateCallbackCalled);
264 ASSERT_FALSE(updateError.empty()); 264 ASSERT_FALSE(updateError.empty());
265 } 265 }
OLDNEW
« no previous file with comments | « test/JsValue.cpp ('k') | test/WebRequest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld