Skip to content

Commit

Permalink
8f8d2e4 Roll protocol to r530755
Browse files Browse the repository at this point in the history
  • Loading branch information
chazkii committed Jan 20, 2018
1 parent 5aa223d commit e62b213
Show file tree
Hide file tree
Showing 43 changed files with 15,361 additions and 14,274 deletions.
18 changes: 3 additions & 15 deletions chromewhip/protocol/accessibility.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def __init__(self,
# AXProperty:
class AXProperty(ChromeTypeBase):
def __init__(self,
name: Union['str'],
name: Union['AXPropertyName'],
value: Union['AXValue'],
):

Expand All @@ -90,20 +90,8 @@ def __init__(self,
self.sources = sources


# AXGlobalStates: States which apply to every AX node.
AXGlobalStates = str

# AXLiveRegionAttributes: Attributes which apply to nodes in live regions.
AXLiveRegionAttributes = str

# AXWidgetAttributes: Attributes which apply to widgets.
AXWidgetAttributes = str

# AXWidgetStates: States which apply to widgets.
AXWidgetStates = str

# AXRelationshipAttributes: Relationships between elements other than parent/child/sibling.
AXRelationshipAttributes = str
# AXPropertyName: Values of AXProperty name: from 'busy' to 'roledescription' - states which apply to every AXnode, from 'live' to 'root' - attributes which apply to nodes in live regions, from'autocomplete' to 'valuetext' - attributes which apply to widgets, from 'checked' to 'selected'- states which apply to widgets, from 'activedescendant' to 'owns' - relationships betweenelements other than parent/child/sibling.
AXPropertyName = str

# AXNode: A node in the accessibility tree.
class AXNode(ChromeTypeBase):
Expand Down
184 changes: 92 additions & 92 deletions chromewhip/protocol/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,6 @@ def __init__(self,
class Animation(PayloadMixin):
"""
"""
@classmethod
def enable(cls):
"""Enables animation domain notifications.
"""
return (
cls.build_send_payload("enable", {
}),
None
)

@classmethod
def disable(cls):
"""Disables animation domain notifications.
Expand All @@ -115,31 +105,11 @@ def disable(cls):
)

@classmethod
def getPlaybackRate(cls):
"""Gets the playback rate of the document timeline.
"""
return (
cls.build_send_payload("getPlaybackRate", {
}),
cls.convert_payload({
"playbackRate": {
"class": float,
"optional": False
},
})
)

@classmethod
def setPlaybackRate(cls,
playbackRate: Union['float'],
):
"""Sets the playback rate of the document timeline.
:param playbackRate: Playback rate for animations on page
:type playbackRate: float
def enable(cls):
"""Enables animation domain notifications.
"""
return (
cls.build_send_payload("setPlaybackRate", {
"playbackRate": playbackRate,
cls.build_send_payload("enable", {
}),
None
)
Expand All @@ -165,45 +135,53 @@ def getCurrentTime(cls,
)

@classmethod
def setPaused(cls,
animations: Union['[]'],
paused: Union['bool'],
):
"""Sets the paused state of a set of animations.
:param animations: Animations to set the pause state of.
def getPlaybackRate(cls):
"""Gets the playback rate of the document timeline.
"""
return (
cls.build_send_payload("getPlaybackRate", {
}),
cls.convert_payload({
"playbackRate": {
"class": float,
"optional": False
},
})
)

@classmethod
def releaseAnimations(cls,
animations: Union['[]'],
):
"""Releases a set of animations to no longer be manipulated.
:param animations: List of animation ids to seek.
:type animations: []
:param paused: Paused state to set to.
:type paused: bool
"""
return (
cls.build_send_payload("setPaused", {
cls.build_send_payload("releaseAnimations", {
"animations": animations,
"paused": paused,
}),
None
)

@classmethod
def setTiming(cls,
animationId: Union['str'],
duration: Union['float'],
delay: Union['float'],
):
"""Sets the timing of an animation node.
def resolveAnimation(cls,
animationId: Union['str'],
):
"""Gets the remote object of the Animation.
:param animationId: Animation id.
:type animationId: str
:param duration: Duration of the animation.
:type duration: float
:param delay: Delay of the animation.
:type delay: float
"""
return (
cls.build_send_payload("setTiming", {
cls.build_send_payload("resolveAnimation", {
"animationId": animationId,
"duration": duration,
"delay": delay,
}),
None
cls.convert_payload({
"remoteObject": {
"class": Runtime.RemoteObject,
"optional": False
},
})
)

@classmethod
Expand All @@ -226,45 +204,67 @@ def seekAnimations(cls,
)

@classmethod
def releaseAnimations(cls,
animations: Union['[]'],
):
"""Releases a set of animations to no longer be manipulated.
:param animations: List of animation ids to seek.
def setPaused(cls,
animations: Union['[]'],
paused: Union['bool'],
):
"""Sets the paused state of a set of animations.
:param animations: Animations to set the pause state of.
:type animations: []
:param paused: Paused state to set to.
:type paused: bool
"""
return (
cls.build_send_payload("releaseAnimations", {
cls.build_send_payload("setPaused", {
"animations": animations,
"paused": paused,
}),
None
)

@classmethod
def resolveAnimation(cls,
animationId: Union['str'],
):
"""Gets the remote object of the Animation.
def setPlaybackRate(cls,
playbackRate: Union['float'],
):
"""Sets the playback rate of the document timeline.
:param playbackRate: Playback rate for animations on page
:type playbackRate: float
"""
return (
cls.build_send_payload("setPlaybackRate", {
"playbackRate": playbackRate,
}),
None
)

@classmethod
def setTiming(cls,
animationId: Union['str'],
duration: Union['float'],
delay: Union['float'],
):
"""Sets the timing of an animation node.
:param animationId: Animation id.
:type animationId: str
:param duration: Duration of the animation.
:type duration: float
:param delay: Delay of the animation.
:type delay: float
"""
return (
cls.build_send_payload("resolveAnimation", {
cls.build_send_payload("setTiming", {
"animationId": animationId,
"duration": duration,
"delay": delay,
}),
cls.convert_payload({
"remoteObject": {
"class": Runtime.RemoteObject,
"optional": False
},
})
None
)



class AnimationCreatedEvent(BaseEvent):
class AnimationCanceledEvent(BaseEvent):

js_name = 'Animation.animationCreated'
js_name = 'Animation.animationCanceled'
hashable = ['id']
is_hashable = True

Expand All @@ -285,21 +285,21 @@ def build_hash(cls, id):
return h


class AnimationStartedEvent(BaseEvent):
class AnimationCreatedEvent(BaseEvent):

js_name = 'Animation.animationStarted'
hashable = ['animationId']
js_name = 'Animation.animationCreated'
hashable = ['id']
is_hashable = True

def __init__(self,
animation: Union['Animation', dict],
id: Union['str', dict],
):
if isinstance(animation, dict):
animation = Animation(**animation)
self.animation = animation
if isinstance(id, dict):
id = str(**id)
self.id = id

@classmethod
def build_hash(cls, animationId):
def build_hash(cls, id):
kwargs = locals()
kwargs.pop('cls')
serialized_id_params = ','.join(['='.join([p, str(v)]) for p, v in kwargs.items()])
Expand All @@ -308,21 +308,21 @@ def build_hash(cls, animationId):
return h


class AnimationCanceledEvent(BaseEvent):
class AnimationStartedEvent(BaseEvent):

js_name = 'Animation.animationCanceled'
hashable = ['id']
js_name = 'Animation.animationStarted'
hashable = ['animationId']
is_hashable = True

def __init__(self,
id: Union['str', dict],
animation: Union['Animation', dict],
):
if isinstance(id, dict):
id = str(**id)
self.id = id
if isinstance(animation, dict):
animation = Animation(**animation)
self.animation = animation

@classmethod
def build_hash(cls, id):
def build_hash(cls, animationId):
kwargs = locals()
kwargs.pop('cls')
serialized_id_params = ','.join(['='.join([p, str(v)]) for p, v in kwargs.items()])
Expand Down
59 changes: 30 additions & 29 deletions chromewhip/protocol/applicationcache.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,28 +60,49 @@ class ApplicationCache(PayloadMixin):
"""
"""
@classmethod
def getFramesWithManifests(cls):
"""Returns array of frame identifiers with manifest urls for each frame containing a document associated with some application cache.
def enable(cls):
"""Enables application cache domain notifications.
"""
return (
cls.build_send_payload("getFramesWithManifests", {
cls.build_send_payload("enable", {
}),
None
)

@classmethod
def getApplicationCacheForFrame(cls,
frameId: Union['Page.FrameId'],
):
"""Returns relevant application cache data for the document in given frame.
:param frameId: Identifier of the frame containing document whose application cache is retrieved.
:type frameId: Page.FrameId
"""
return (
cls.build_send_payload("getApplicationCacheForFrame", {
"frameId": frameId,
}),
cls.convert_payload({
"frameIds": {
"class": [FrameWithManifest],
"applicationCache": {
"class": ApplicationCache,
"optional": False
},
})
)

@classmethod
def enable(cls):
"""Enables application cache domain notifications.
def getFramesWithManifests(cls):
"""Returns array of frame identifiers with manifest urls for each frame containing a document
associated with some application cache.
"""
return (
cls.build_send_payload("enable", {
cls.build_send_payload("getFramesWithManifests", {
}),
None
cls.convert_payload({
"frameIds": {
"class": [FrameWithManifest],
"optional": False
},
})
)

@classmethod
Expand All @@ -104,26 +125,6 @@ def getManifestForFrame(cls,
})
)

@classmethod
def getApplicationCacheForFrame(cls,
frameId: Union['Page.FrameId'],
):
"""Returns relevant application cache data for the document in given frame.
:param frameId: Identifier of the frame containing document whose application cache is retrieved.
:type frameId: Page.FrameId
"""
return (
cls.build_send_payload("getApplicationCacheForFrame", {
"frameId": frameId,
}),
cls.convert_payload({
"applicationCache": {
"class": ApplicationCache,
"optional": False
},
})
)



class ApplicationCacheStatusUpdatedEvent(BaseEvent):
Expand Down
Loading

0 comments on commit e62b213

Please sign in to comment.