Question about testing and debugging Chrome extension download API

27 views
Skip to first unread message

dwapps

unread,
Sep 17, 2021, 4:55:51 PM9/17/21
to Chromium Extensions
Hello.
I am currently developing a chrome extension related to downloads.

I've been trying to do some testing with the download API to make sure my code works well.
However, I couldn't find a way to intentionally cause the download error.

I would like to know how to trigger various download errors (like "NETWORK_FAILED").
If you know an answer to this, could you please let me know?

Thank you.

hrg...@gmail.com

unread,
Sep 17, 2021, 9:24:32 PM9/17/21
to Chromium Extensions, dwapps
The easiest and fastest way is to disconnect your computer from the network, i.e. just pull the plug.
If you are using Wi-Fi or your network cable is not easily reachable, you can go to your network configuration and disconnect/disable the connection.
If you don't like any of those alternatives, for whatever reason, you can add a filter rule to your firewall that filters all traffic to the specific IP address that you want to break.

Other errors such as unreachable host, server error, 404, 403, etc. can be triggered by creating a download to a fake domain or to a URL that you know that gives 404 or 403, etc.

dwapps

unread,
Sep 18, 2021, 5:12:03 AM9/18/21
to Chromium Extensions, hrg...@gmail.com, dwapps
Thank you for the reply.

I think the solution to disconnecting the internet by myself or creating a server myself is fine.
Currently, I am trying to debug and test this way.

However, there are various errors in InterruptReason of Chrome Extension API downloads,  

and I am wondering if there is a way to select and trigger the error I want to test.


2021년 9월 18일 토요일 오전 10시 24분 32초 UTC+9에 hrg...@gmail.com님이 작성:
Reply all
Reply to author
Forward
0 new messages