1 /* 2 * Copyright (C) 2018 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.google.android.exoplayer2.ext.ima; 17 18 import com.google.ads.interactivemedia.v3.api.AdDisplayContainer; 19 import com.google.ads.interactivemedia.v3.api.AdsRequest; 20 import com.google.ads.interactivemedia.v3.api.player.ContentProgressProvider; 21 import java.util.List; 22 import java.util.Map; 23 24 /** Fake {@link AdsRequest} implementation for tests. */ 25 public final class FakeAdsRequest implements AdsRequest { 26 27 private String adTagUrl; 28 private String adsResponse; 29 private Object userRequestContext; 30 private AdDisplayContainer adDisplayContainer; 31 private ContentProgressProvider contentProgressProvider; 32 33 @Override setAdTagUrl(String adTagUrl)34 public void setAdTagUrl(String adTagUrl) { 35 this.adTagUrl = adTagUrl; 36 } 37 38 @Override getAdTagUrl()39 public String getAdTagUrl() { 40 return adTagUrl; 41 } 42 43 @Override setExtraParameter(String s, String s1)44 public void setExtraParameter(String s, String s1) { 45 throw new UnsupportedOperationException(); 46 } 47 48 @Override getExtraParameter(String s)49 public String getExtraParameter(String s) { 50 throw new UnsupportedOperationException(); 51 } 52 53 @Override getExtraParameters()54 public Map<String, String> getExtraParameters() { 55 throw new UnsupportedOperationException(); 56 } 57 58 @Override setUserRequestContext(Object userRequestContext)59 public void setUserRequestContext(Object userRequestContext) { 60 this.userRequestContext = userRequestContext; 61 } 62 63 @Override getUserRequestContext()64 public Object getUserRequestContext() { 65 return userRequestContext; 66 } 67 68 @Override getAdDisplayContainer()69 public AdDisplayContainer getAdDisplayContainer() { 70 return adDisplayContainer; 71 } 72 73 @Override setAdDisplayContainer(AdDisplayContainer adDisplayContainer)74 public void setAdDisplayContainer(AdDisplayContainer adDisplayContainer) { 75 this.adDisplayContainer = adDisplayContainer; 76 } 77 78 @Override getContentProgressProvider()79 public ContentProgressProvider getContentProgressProvider() { 80 return contentProgressProvider; 81 } 82 83 @Override setContentProgressProvider(ContentProgressProvider contentProgressProvider)84 public void setContentProgressProvider(ContentProgressProvider contentProgressProvider) { 85 this.contentProgressProvider = contentProgressProvider; 86 } 87 88 @Override getAdsResponse()89 public String getAdsResponse() { 90 return adsResponse; 91 } 92 93 @Override setAdsResponse(String adsResponse)94 public void setAdsResponse(String adsResponse) { 95 this.adsResponse = adsResponse; 96 } 97 98 @Override setAdWillAutoPlay(boolean b)99 public void setAdWillAutoPlay(boolean b) { 100 throw new UnsupportedOperationException(); 101 } 102 103 @Override setAdWillPlayMuted(boolean b)104 public void setAdWillPlayMuted(boolean b) { 105 throw new UnsupportedOperationException(); 106 } 107 108 @Override setContentDuration(float v)109 public void setContentDuration(float v) { 110 throw new UnsupportedOperationException(); 111 } 112 113 @Override setContentKeywords(List<String> list)114 public void setContentKeywords(List<String> list) { 115 throw new UnsupportedOperationException(); 116 } 117 118 @Override setContentTitle(String s)119 public void setContentTitle(String s) { 120 throw new UnsupportedOperationException(); 121 } 122 123 @Override setVastLoadTimeout(float v)124 public void setVastLoadTimeout(float v) { 125 throw new UnsupportedOperationException(); 126 } 127 128 @Override setLiveStreamPrefetchSeconds(float v)129 public void setLiveStreamPrefetchSeconds(float v) { 130 throw new UnsupportedOperationException(); 131 } 132 } 133