| OLD | NEW |
| 1 <!-- | 1 <!-- |
| 2 # Copyright 2016 The LUCI Authors. All rights reserved. | 2 # Copyright 2016 The LUCI Authors. All rights reserved. |
| 3 # Use of this source code is governed by the Apache v2.0 license that can be | 3 # Use of this source code is governed by the Apache v2.0 license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 --> | 5 --> |
| 6 <!DOCTYPE html> | 6 <!DOCTYPE html> |
| 7 <html> | 7 <html> |
| 8 <head> | 8 <head> |
| 9 <title>Swarming index Demo</title> | 9 <title>Swarming index Demo</title> |
| 10 <meta charset="utf-8"> | 10 <meta charset="utf-8"> |
| 11 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> | 11 <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
| 12 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1, user-scalable=yes"> | 12 <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-
scale=1, user-scalable=yes"> |
| 13 <script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></scri
pt> | 13 <script src="../bower_components/webcomponentsjs/webcomponents-lite.js"></scri
pt> |
| 14 <script src="../../../node_modules/skia-common-js/common.js"></script> |
| 15 <script src="/res/js/common.js"></script> |
| 16 <script src="/res/js/alias.js"></script> |
| 14 <script src="../../../node_modules/sinon/pkg/sinon-1.17.5.js"></script> | 17 <script src="../../../node_modules/sinon/pkg/sinon-1.17.5.js"></script> |
| 15 | 18 |
| 16 <script type="text/javascript" charset="utf-8"> | 19 <script type="text/javascript" charset="utf-8"> |
| 17 sinon.format = function(object) {return JSON.stringify(object);} | 20 sinon.format = function(object) {return JSON.stringify(object);} |
| 18 sinon.log = function(message) {console.log(message);}; | 21 sinon.log = function(message) {console.log(message);}; |
| 19 var server = sinon.fakeServer.create(); | 22 var server = sinon.fakeServer.create(); |
| 20 server.autoRespondAfter = 1200; | 23 server.autoRespondAfter = 1200; |
| 21 server.autoRespond = true; | 24 server.autoRespond = true; |
| 22 | 25 |
| 23 var details = { | 26 var details = { |
| 24 server_version: "not-quite-ready", | 27 server_version: "not-quite-ready", |
| 25 }; | 28 }; |
| 26 | 29 |
| 27 var respond = function(request){ | 30 var respond = function(request){ |
| 28 if (!request.requestHeaders.authorization) { | 31 if (!request.requestHeaders.authorization) { |
| 29 sinon.log("You must be logged in (check your Oauth?)"); | 32 sinon.log("You must be logged in (check your Oauth?)"); |
| 30 request.respond(403, {}, "You must be logged in (check your Oauth?)"); | 33 request.respond(403, {}, "You must be logged in (check your Oauth?)"); |
| 31 return; | 34 return; |
| 32 } | 35 } |
| 33 sinon.log("User authenticated :) "+ request.requestHeaders.authorization); | 36 sinon.log("User authenticated :) "+ request.requestHeaders.authorization); |
| 34 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(d
etails)); | 37 request.respond(200, {"Content-Type":"application/json"}, JSON.stringify(d
etails)); |
| 35 } | 38 } |
| 36 | 39 |
| 37 server.respondWith("GET", "/_ah/api/swarming/v1/server/details", respond); | 40 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/server\/details/, res
pond); |
| 38 server.respondWith("GET", "/api/swarming/v1/server/details", respond); | 41 server.respondWith("GET", /^\/api\/swarming\/v1\/server\/details/, respond); |
| 42 |
| 43 var permissions = { |
| 44 get_bootstrap_token: true |
| 45 }; |
| 46 server.respondWith("GET", /^\/_ah\/api\/swarming\/v1\/server\/permissions/,
JSON.stringify(permissions)); |
| 47 server.respondWith("GET", /^\/api\/swarming\/v1\/server\/permissions/, JSON.
stringify(permissions)); |
| 39 </script> | 48 </script> |
| 40 | 49 |
| 41 <link rel="import" href="swarming-index.html"> | 50 <link rel="import" href="swarming-index.html"> |
| 42 </head> | 51 </head> |
| 43 <body> | 52 <body> |
| 44 | 53 |
| 45 <swarming-index></swarming-index> | 54 <swarming-index |
| 55 client_id="20770472288-t5smpbpjptka4nd888fv0ctd23ftba2o.apps.googleusercontent
.com"> |
| 56 </swarming-index> |
| 46 | 57 |
| 47 </body> | 58 </body> |
| 48 </html> | 59 </html> |
| OLD | NEW |