skia: Use medium filter quality in PaintSimplifier.
[chromium-blink-merge.git] / chrome / test / data / is_search_provider_installed.html
blob23b64f14adf9d56229c5fd1298534ef09b0f3a97
1 <html>
2 <body>
3 <p>Test IsProviderInstalled.<p>
4 <div id=result>
5 </div>
6 <script>
7 var passedAll = true;
9 function log(message) {
10 document.getElementById("result").innerHTML += message + "<br>";
13 function logPassed(message) {
14 log("PASS: " + message);
17 function logFailed(message) {
18 passedAll = false;
19 log("FAIL: " + message);
22 function verifyExceptionFor(testName, origin) {
23 try {
24 window.external.IsSearchProviderInstalled(origin);
25 logFailed("No exception for a " + testName + " (" + origin + ").");
26 } catch (e) {
27 logPassed("Got an exception for a " + testName + " (" + origin + ").");
31 function writeResult() {
32 var result = "1";
33 if (passedAll) {
34 logPassed("Everything passed.");
35 document.title = "OK";
36 } else {
37 logFailed("At least one test failed.");
38 document.title = "FAIL"
42 try {
43 var differentProtocol =
44 document.location.protocol == "http:" ? "https:" : "http:";
45 var differentPort =
46 (!document.location.port || document.location.port == "80") ? ":81" : ":80";
48 var origin = document.location.protocol + "//" + document.location.host + "/";
49 var originWithDifferentProtocol = differentProtocol + "//" +
50 document.location.host + "/";
51 var originWithDifferentPort = document.location.protocol + "//" +
52 document.location.hostname + differentPort + "/";
54 // Verify existence of the api.
55 var foundApi = false;
56 try {
57 if (window.external.IsSearchProviderInstalled)
58 foundApi = true;
59 } catch (e) {
62 if (foundApi)
63 logPassed("IsSearchProvider api exists.");
64 else {
65 logFailed("IsSearchProvider api doesn't exist.");
66 writeResult();
67 return;
70 // Verify the search provider state for the current page.
71 var installed = window.external.IsSearchProviderInstalled(origin)
72 var installedMessage = "Search provider ("+ origin +"): " + installed + ".";
73 if (installed == document.location.hash.substring(1))
74 logPassed(installedMessage);
75 else
76 logFailed(installedMessage + " The expected result is passed as the hash.");
78 // Verify that cases that should result in exceptions.
79 verifyExceptionFor("different host", "http://example.org/");
80 verifyExceptionFor("different protocol", originWithDifferentProtocol);
81 verifyExceptionFor("different port", originWithDifferentPort);
83 writeResult();
84 } catch (e) {
85 logFailed("An exception occurred. Name: " + e.name + " Message: " +
86 e.message);
87 writeResult();
89 </script>
90 </body>
91 </html>