Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automated system testing for chromecast receiver application

I am wondering if there is a good way of making automated system testing for a Chromecast receiver application?

If you open the application URL in a Chrome browser, the cast_receiver library cannot find the websocket connection on:

ws://localhost:8008/v2/ipc

Since this handles the communication between the app and the Chromecast hardware, I am thinking of something like a Node.js websocket server that can talk to the chromecast receiver app. Is there such a system, or do anyone know if there are plans of google releasing something for this kind of testing?

Also, would there be other problems related to the difference between the chromecast browser and chrome browser? As I understand, the chromecast browser is just a subset of chrome, which makes me think it should work.

like image 1000
William Avatar asked Nov 11 '22 09:11

William


1 Answers

No, there is no easy way to do this.

DISCLAIMER: I haven't tried any of what I'm about to suggest. It's also probably a terribly idea as Google could change the protocol any time and in any fashion they desire since it isn't a public thing.

BIG DISCLAIMER: You may be in violation of the ToS by doing this as Section 3.2 (Developer Policies) states that you "may not ... develop a standalone technology ... any functionality of any Google Cast Receiver". Possibly, you'd be making a standalone piece of technology that replicated the IPC functionality. But I don't know. I'm not a lawyer.

If you want to go and do this, I'd suggest making a copy of the Google Cast Receiver SDK (www.gstatic.com/cast/sdk/libs/receiver/2.0.0/cast_receiver.js as of April 28, 2015) and altering it so that it logs out the messages that are being sent and received.

Luckily, it appears that we have logging messages to help us find the relevant code.

The receiving method has the string "Received message". I would guess that "a.message" is what is being received.

The sending method has the string "IPC message sent". I would guess that "a" is what is being sent.

Once you've instrumented your copy of the code, you need to publish it somewhere that your receiver app can see it and then you need to edit your receiver app to point to your new and improved SDK. Please please please make sure that you do this on a non-published app for testing purposes only.

Once that is done, you need to find some way to get your messages out of the code and into something that you can access. You have a few options.

  1. Fiddle around with the code more and figure out how to get the Chromecast to log out the data you want;
  2. Store the information in an array and read it using the debugger;
  3. Open your own socket (or websocket) and send that data to a server that you control.

From here, you can run your app, interact with it, and then have a complete record of the IPC messages that were sent and received. Armed with this, you can create your own Fake-IPC server that listens for specific messages and spits out the stuff that is in your log.

like image 155
justhecuke Avatar answered Jan 04 '23 02:01

justhecuke