am 6e267c65: Merge "TIF: Add a test case for TvView.TvInputCallback.onVideoSizeChanged()" into lollipop-mr1-cts-dev

* commit '6e267c654eba2694164736177eaad458ea3668ab':
  TIF: Add a test case for TvView.TvInputCallback.onVideoSizeChanged()
diff --git a/tests/tests/tv/src/android/media/tv/cts/TvInputServiceTest.java b/tests/tests/tv/src/android/media/tv/cts/TvInputServiceTest.java
index 65a66b3..7068035 100644
--- a/tests/tests/tv/src/android/media/tv/cts/TvInputServiceTest.java
+++ b/tests/tests/tv/src/android/media/tv/cts/TvInputServiceTest.java
@@ -50,8 +50,8 @@
     private static final long TIME_OUT = 15000L;
     private static final String mDummyTrackId = "dummyTrackId";
     private static final TvTrackInfo mDummyTrack =
-            new TvTrackInfo.Builder(TvTrackInfo.TYPE_SUBTITLE, mDummyTrackId)
-            .setLanguage("und").build();
+            new TvTrackInfo.Builder(TvTrackInfo.TYPE_VIDEO, mDummyTrackId)
+            .setVideoWidth(1920).setVideoHeight(1080).setLanguage("und").build();
 
     private TvView mTvView;
     private Activity mActivity;
@@ -66,6 +66,7 @@
         private int mVideoUnavailableCount;
         private int mTrackSelectedCount;
         private int mTrackChangedCount;
+        private int mVideoSizeChanged;
         private int mContentAllowedCount;
         private int mContentBlockedCount;
 
@@ -95,6 +96,11 @@
         }
 
         @Override
+        public void onVideoSizeChanged(String inputId, int width, int height) {
+            mVideoSizeChanged++;
+        }
+
+        @Override
         public void onContentAllowed(String inputId) {
             mContentAllowedCount++;
         }
@@ -369,6 +375,21 @@
         }.run();
     }
 
+    public void verifyCallbackVideoSizeChanged() {
+        resetCounts();
+        CountingSession session = CountingTvInputService.sSession;
+        assertNotNull(session);
+        ArrayList<TvTrackInfo> tracks = new ArrayList<>();
+        tracks.add(mDummyTrack);
+        session.notifyTracksChanged(tracks);
+        new PollingCheck(TIME_OUT) {
+            @Override
+            protected boolean check() {
+                return mCallback.mVideoSizeChanged > 0;
+            }
+        }.run();
+    }
+
     public void verifyCallbackTrackSelected() {
         resetCounts();
         CountingSession session = CountingTvInputService.sSession;