- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / test / data / native_messaging / native_hosts / empty_app.py
1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # This native client will read full messages, but do nothing with them and
7 # send no responses.
8
9 import sys
10 import struct
11
12 while 1:
13   # Read the message type (first 4 bytes).
14   typeBytes = sys.stdin.read(4)
15
16   if len(typeBytes) == 0:
17     break
18
19   # Read the message length (4 bytes).
20   textLength = struct.unpack('i', sys.stdin.read(4))[0]
21
22   # Read the text (JSON object) of the message.
23   text = sys.stdin.read(textLength)