ó
>Mc           @   s£   d  d l  m Z yL d  d l m Z m Z m Z d  d l m Z m	 Z	 m
 Z
 d  d l m Z Wn e k
 ru d Z n Xd  d l m Z d e j f d „  ƒ  YZ d	 S(
   iÿÿÿÿ(   t   unittest(   t   iocpsupportt   tcpt   udp(   t   IOCPReactort   EVENTS_PER_LOOPt
   KEY_NORMAL(   t   IReadWriteHandles%   This test only applies to IOCPReactor(   t   verifyClasst   IOCPReactorTestCasec           B   s#   e  Z d  „  Z d „  Z d „  Z RS(   c         C   s-   t  ƒ  } | j ƒ  |  j | j d ƒ ƒ d S(   sd   
        Test reactor behavior (doIteration) when there are no pending time
        events.
        N(   R   t   wakeUpt   failIft   doIterationt   None(   t   selft   ir(    (    sC   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_iocp.pyt   test_noPendingTimerEvents   s    	
c         C   s$   t  t t j ƒ t  t t j ƒ d S(   sY   
        Verify that IOCP socket-representing classes implement IReadWriteHandle
        N(   R   R   R   t
   ConnectionR   t   Port(   R   (    (    sC   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_iocp.pyt   test_reactorInterfaces   s    c         C   s³   d d d „  ƒ  Y} t  ƒ  } | ƒ  } t j | j | ƒ } x. t t d ƒ D] } | j j d t | ƒ qK W| j	 d ƒ |  j | j t ƒ | j	 d ƒ |  j | j t d ƒ d S(   s†   
        Verify that we don't lose an event when more than EVENTS_PER_LOOP
        events occur in the same reactor iteration
        t   FakeFDc           B   s    e  Z d  Z d „  Z d „  Z RS(   i    c         S   s   d S(   NR   (    (   R   (    (    sC   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_iocp.pyt	   logPrefix&   s    c         S   s   |  j  d 7_  d  S(   Ni   (   t   counter(   R   t   rct   bytest   evt(    (    sC   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_iocp.pyt   cb(   s    (   t   __name__t
   __module__R   R   R   (    (    (    sC   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_iocp.pyR   $   s   	i   i    N(    (   R   t   _iocpt   EventR   t   rangeR   t   portt	   postEventR   R   R   t   assertEqualsR   (   R   R   R   t   fdt   eventt   _(    (    sC   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_iocp.pyt   test_maxEventsPerIteration   s    		(   R   R   R   R   R&   (    (    (    sC   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_iocp.pyR	      s   	
	N(   t   twisted.trialR    t   twisted.internet.iocpreactorR   R   R   R   t$   twisted.internet.iocpreactor.reactorR   R   R   t'   twisted.internet.iocpreactor.interfacesR   t   ImportErrort   skipt   zope.interface.verifyR   t   TestCaseR	   (    (    (    sC   /usr/lib/python2.7/dist-packages/twisted/internet/test/test_iocp.pyt   <module>   s   
