Confirmed users
1,759
edits
| Line 37: | Line 37: | ||
== Creating a new Content Provider test == | == Creating a new Content Provider test == | ||
We have infrastructure for testing content providers in an isolated environment. This means that we ensure that any updates to the databases behind content providers will not affect or be affected by | We have infrastructure for testing content providers in an isolated environment. This means that we ensure that any updates to the databases behind content providers will not affect or be affected by Firefox. | ||
To write a content provider test, | To write a content provider test, follow the same file naming and Java packaging guidelines described for UI tests, but create a class that inherits from ''ContentProviderTest'' instead of ''BaseTest''. Each Content Provider test class must have the same three methods as UI tests (setUp(), test[YourFeature]() and tearDown) with one important difference: the ''setUp()'' method should call the following parent method: | ||
<pre> | <pre> | ||
| Line 54: | Line 54: | ||
</pre> | </pre> | ||
After this is called, ''mProvider'' will point to | After this is called, ''mProvider'' will point to an isolated instance of your content provider and you can make insert/query/update/delete calls on it as expected. For more details and sample code on how to implement Content Provider tests, see testBrowserProvider.java.in. | ||
= APIs = | = APIs = | ||