Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Centro adapter to allow requests of the same units #1746

Merged
merged 23 commits into from
Oct 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9edcb2b
Add centro adapter and tests for it.
Aug 23, 2016
fa9d30d
Merge remote-tracking branch 'upstream/master'
Oct 4, 2016
6f95de6
Merge remote-tracking branch 'upstream/master'
Nov 18, 2016
f1e2aed
Merge remote-tracking branch 'upstream/master'
Dec 21, 2016
9c54140
Merge remote-tracking branch 'upstream/master'
Feb 16, 2017
47c74aa
fix bug with different types of bid.sectionID and bid.unit from config
Feb 16, 2017
d0ca7a0
add query parameter adapter=prebid
Feb 16, 2017
8a092fe
update tests for centro adapter
Feb 16, 2017
b91f3c3
Merge remote-tracking branch 'upstream/master'
Mar 20, 2017
c3a9704
fixed bug with call of JSONP callback with name, that contain invalid…
Mar 23, 2017
7f22e07
Merge remote-tracking branch 'upstream/master'
Mar 23, 2017
3f0ab76
Merge remote-tracking branch 'upstream/master'
Jun 5, 2017
4c134fb
Centro adapter fix: do not call logError if 'No Bid' was received
Jun 5, 2017
850255b
Merge remote-tracking branch 'upstream/master'
Jun 15, 2017
8d70cc0
Centro adapter: pass the bid request object to bidfactory.createBid
Jun 15, 2017
52b0021
Centro adapter: fix ESLintError
Jun 15, 2017
e17a2c4
Merge remote-tracking branch 'upstream/master'
Jul 5, 2017
ab03410
Merge remote-tracking branch 'upstream/master'
Jul 13, 2017
f172b4a
Merge remote-tracking branch 'upstream/master'
Aug 8, 2017
f9f0434
Merge remote-tracking branch 'upstream/master'
Oct 23, 2017
c95f9b1
Fix Centro adapter to allow requests of the same units
Oct 23, 2017
b7cdd0c
Merge remote-tracking branch 'upstream/master'
Oct 24, 2017
e311ea7
Fix spec file for Centro adapter
Oct 24, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion modules/centroBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ var CentroAdapter = function CentroAdapter() {
query.push('sz=' + size.join('x'));
}
// make handler name for JSONP request
var handlerName = handlerPrefix + bid.unit + size.join('x') + encodeURIComponent(requestedBid.placementCode);
var handlerName = handlerPrefix + bid.unit + size.join('x') + encodeURIComponent(requestedBid.bidId);
query.push('callback=' + encodeURIComponent('window["' + handlerName + '"]'));

// maybe is needed add some random parameter to disable cache
Expand Down
23 changes: 15 additions & 8 deletions test/spec/modules/centroBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ describe('centro adapter tests', function () {
unit: 28136,
page_url: 'http://test_url.ru'
},
bidId: '1234',
placementCode: 'div-gpt-ad-12345-1'
},
{
Expand All @@ -51,12 +52,14 @@ describe('centro adapter tests', function () {
params: {
unit: 28137
},
bidId: '5678',
placementCode: 'div-gpt-ad-12345-2'
},
{
bidder: 'centro',
sizes: [[728, 90]],
params: {},
bidId: '9101112',
placementCode: 'div-gpt-ad-12345-3'
}
]
Expand All @@ -71,7 +74,7 @@ describe('centro adapter tests', function () {

var parsedBidUrl = urlParse(bidUrl1);
var parsedBidUrlQueryString = querystringify.parse(parsedBidUrl.query);
var generatedCallback = 'window["adCentroHandler_28136300x250div-gpt-ad-12345-1"]';
var generatedCallback = 'window["adCentroHandler_28136300x2501234"]';

expect(parsedBidUrl.hostname).to.equal('staging.brand-server.com');
expect(parsedBidUrl.pathname).to.equal('/hb');
Expand All @@ -85,7 +88,7 @@ describe('centro adapter tests', function () {

parsedBidUrl = urlParse(bidUrl2);
parsedBidUrlQueryString = querystringify.parse(parsedBidUrl.query);
generatedCallback = 'window["adCentroHandler_28137728x90div-gpt-ad-12345-2"]';
generatedCallback = 'window["adCentroHandler_28137728x905678"]';

expect(parsedBidUrl.hostname).to.equal('t.brand-server.com');
expect(parsedBidUrl.pathname).to.equal('/hb');
Expand Down Expand Up @@ -117,6 +120,7 @@ describe('centro adapter tests', function () {
params: {
unit: 28136
},
bidId: '12345',
placementCode: '/19968336/header-bid-tag-0'
},
{
Expand All @@ -125,6 +129,7 @@ describe('centro adapter tests', function () {
params: {
unit: 111111
},
bidId: '12346',
placementCode: '/19968336/header-bid-tag-1'
},
{
Expand All @@ -133,6 +138,7 @@ describe('centro adapter tests', function () {
params: {
unit: 222222
},
bidId: '12347',
placementCode: '/19968336/header-bid-tag-2'
},
{
Expand All @@ -141,6 +147,7 @@ describe('centro adapter tests', function () {
params: {
unit: 333333
},
bidId: '12348',
placementCode: '/19968336/header-bid-tag-3'
}
]
Expand All @@ -149,9 +156,9 @@ describe('centro adapter tests', function () {
it('callback function should exist', function () {
adapter().callBids(params);

expect(window['adCentroHandler_28136300x250%2F19968336%2Fheader-bid-tag-0'])
expect(window['adCentroHandler_28136300x25012345'])
.to.exist.and.to.be.a('function');
expect(window['adCentroHandler_111111728x90%2F19968336%2Fheader-bid-tag-1'])
expect(window['adCentroHandler_111111728x9012346'])
.to.exist.and.to.be.a('function');
});

Expand Down Expand Up @@ -180,10 +187,10 @@ describe('centro adapter tests', function () {
var response3 = {'adTag': '', 'height': 0, 'value': 0, 'width': 0, 'sectionID': 222222};
var response4 = '';

window['adCentroHandler_28136300x250%2F19968336%2Fheader-bid-tag-0'](response);
window['adCentroHandler_111111728x90%2F19968336%2Fheader-bid-tag-1'](response2);
window['adCentroHandler_222222728x90%2F19968336%2Fheader-bid-tag-2'](response3);
window['adCentroHandler_333333728x90%2F19968336%2Fheader-bid-tag-3'](response4);
window['adCentroHandler_28136300x25012345'](response);
window['adCentroHandler_111111728x9012346'](response2);
window['adCentroHandler_222222728x9012347'](response3);
window['adCentroHandler_333333728x9012348'](response4);

var bidPlacementCode1 = stubAddBidResponse.getCall(0).args[0];
var bidObject1 = stubAddBidResponse.getCall(0).args[1];
Expand Down