/src/mozilla-central/toolkit/components/url-classifier/tests/gtest/TestTable.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | #include "gtest/gtest.h" |
2 | | #include "nsUrlClassifierDBService.h" |
3 | | |
4 | | using namespace mozilla::safebrowsing; |
5 | | |
6 | | void |
7 | | TestResponseCode(const char* table, nsresult result) |
8 | 0 | { |
9 | 0 | nsCString tableName(table); |
10 | 0 | ASSERT_EQ(TablesToResponse(tableName), result); |
11 | 0 | } |
12 | | |
13 | | TEST(UrlClassifierTable, ResponseCode) |
14 | 0 | { |
15 | 0 | // malware URIs. |
16 | 0 | TestResponseCode("goog-malware-shavar", NS_ERROR_MALWARE_URI); |
17 | 0 | TestResponseCode("test-malware-simple", NS_ERROR_MALWARE_URI); |
18 | 0 | TestResponseCode("goog-phish-shavar,test-malware-simple", NS_ERROR_MALWARE_URI); |
19 | 0 | TestResponseCode("test-malware-simple,mozstd-track-digest256,mozplugin-block-digest256", NS_ERROR_MALWARE_URI); |
20 | 0 |
|
21 | 0 | // phish URIs. |
22 | 0 | TestResponseCode("goog-phish-shavar", NS_ERROR_PHISHING_URI); |
23 | 0 | TestResponseCode("test-phish-simple", NS_ERROR_PHISHING_URI); |
24 | 0 | TestResponseCode("test-phish-simple,mozplugin-block-digest256", NS_ERROR_PHISHING_URI); |
25 | 0 | TestResponseCode("mozstd-track-digest256,test-phish-simple,goog-unwanted-shavar", NS_ERROR_PHISHING_URI); |
26 | 0 |
|
27 | 0 | // unwanted URIs. |
28 | 0 | TestResponseCode("goog-unwanted-shavar", NS_ERROR_UNWANTED_URI); |
29 | 0 | TestResponseCode("test-unwanted-simple", NS_ERROR_UNWANTED_URI); |
30 | 0 | TestResponseCode("mozplugin-unwanted-digest256,mozfull-track-digest256", NS_ERROR_UNWANTED_URI); |
31 | 0 | TestResponseCode("test-block-simple,mozfull-track-digest256,test-unwanted-simple", NS_ERROR_UNWANTED_URI); |
32 | 0 |
|
33 | 0 | // track URIs. |
34 | 0 | TestResponseCode("test-track-simple", NS_ERROR_TRACKING_URI); |
35 | 0 | TestResponseCode("mozstd-track-digest256", NS_ERROR_TRACKING_URI); |
36 | 0 | TestResponseCode("test-block-simple,mozstd-track-digest256", NS_ERROR_TRACKING_URI); |
37 | 0 |
|
38 | 0 | // block URIs |
39 | 0 | TestResponseCode("test-block-simple", NS_ERROR_BLOCKED_URI); |
40 | 0 | TestResponseCode("mozplugin-block-digest256", NS_ERROR_BLOCKED_URI); |
41 | 0 | TestResponseCode("mozplugin2-block-digest256", NS_ERROR_BLOCKED_URI); |
42 | 0 |
|
43 | 0 | TestResponseCode("test-trackwhite-simple", NS_OK); |
44 | 0 | TestResponseCode("mozstd-trackwhite-digest256", NS_OK); |
45 | 0 | TestResponseCode("goog-badbinurl-shavar", NS_OK); |
46 | 0 | TestResponseCode("goog-downloadwhite-digest256", NS_OK); |
47 | 0 | } |