예제 #1
0
 def testLoadWithAllSelector(self):
   """Both elements are loaded with selector='all'."""
   action = LoadMediaAction(selector='all', timeout_in_seconds=5)
   action.WillRunAction(self._tab)
   action.RunAction(self._tab)
   self.assertTrue(self.eventFired('#video_1', 'canplaythrough'))
   self.assertTrue(self.eventFired('#audio_1', 'canplaythrough'))
예제 #2
0
 def testLoadWithNoSelector(self):
   """With no selector the first media element is loaded."""
   action = LoadMediaAction(timeout_in_seconds=5)
   action.WillRunAction(self._tab)
   action.RunAction(self._tab)
   self.assertTrue(self.eventFired('#video_1', 'canplaythrough'))
   self.assertFalse(self.eventFired('#audio_1', 'canplaythrough'))
예제 #3
0
 def testLoadWithSelector(self):
   """Only the element matching the selector is loaded."""
   action = LoadMediaAction(selector='#audio_1', timeout_in_seconds=5)
   action.WillRunAction(self._tab)
   action.RunAction(self._tab)
   self.assertFalse(self.eventFired('#video_1', 'canplaythrough'))
   self.assertTrue(self.eventFired('#audio_1', 'canplaythrough'))
예제 #4
0
 def testAwaitedEventIsConfigurable(self):
   """It's possible to wait for different events."""
   action = LoadMediaAction(selector='#video_1', timeout_in_seconds=0.1,
                            event_to_await='loadedmetadata')
   action.WillRunAction(self._tab)
   action.RunAction(self._tab)
   self.assertTrue(self.eventFired('#video_1', 'loadedmetadata'))