コード例 #1
0
 def testAsksMonitoringToStop(self):
     devtools_connection = MockDevToolsConnection()
     page_track = PageTrack(devtools_connection)
     for msg in PageTrackTest._EVENTS[:-1]:
         page_track.Handle(msg['method'], msg)
         self.assertFalse(devtools_connection.stop_has_been_called)
     msg = PageTrackTest._EVENTS[-1]
     page_track.Handle(msg['method'], msg)
     self.assertTrue(devtools_connection.stop_has_been_called)
コード例 #2
0
 def testStopsLoadingUnknownFrame(self):
     page_track = PageTrack(None)
     msg = {
         'method': 'Page.frameStoppedLoading',
         'params': {
             'frameId': '1234.12'
         }
     }
     with self.assertRaises(AssertionError):
         page_track.Handle(msg['method'], msg)
コード例 #3
0
 def testUnknownParent(self):
     page_track = PageTrack(None)
     msg = {
         'method': 'Page.frameAttached',
         'params': {
             'frameId': '1234.12',
             'parentFrameId': '1234.1'
         }
     }
     with self.assertRaises(AssertionError):
         page_track.Handle(msg['method'], msg)
コード例 #4
0
 def testGetMainFrameId(self):
     devtools_connection = MockDevToolsConnection()
     page_track = PageTrack(devtools_connection)
     for msg in PageTrackTest._EVENTS:
         page_track.Handle(msg['method'], msg)
     self.assertEquals('1234.1', page_track.GetMainFrameId())