diff options
author | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-22 01:02:29 +0000 |
---|---|---|
committer | erikkay@google.com <erikkay@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-22 01:02:29 +0000 |
commit | ec8a0ab05c4da76c0eaabc340f3f3a374b7e0f58 (patch) | |
tree | cd24ed103618f3e9e5bd8f3ad9d36d256c0e284e /chrome | |
parent | 77e207876f095e51d292896d4dc3c429e754570b (diff) | |
download | chromium_src-ec8a0ab05c4da76c0eaabc340f3f3a374b7e0f58.zip chromium_src-ec8a0ab05c4da76c0eaabc340f3f3a374b7e0f58.tar.gz chromium_src-ec8a0ab05c4da76c0eaabc340f3f3a374b7e0f58.tar.bz2 |
A test extension that shows current buildbot status in the toolbar.
Review URL: http://codereview.chromium.org/87067
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14170 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/test/data/extensions/buildbot/buildbot.html | 112 | ||||
-rw-r--r-- | chrome/test/data/extensions/buildbot/manifest.json | 6 |
2 files changed, 118 insertions, 0 deletions
diff --git a/chrome/test/data/extensions/buildbot/buildbot.html b/chrome/test/data/extensions/buildbot/buildbot.html new file mode 100644 index 0000000..ee21e7d7 --- /dev/null +++ b/chrome/test/data/extensions/buildbot/buildbot.html @@ -0,0 +1,112 @@ +<script> + +var botRoot = "http://build.chromium.org/buildbot/waterfall"; + +var botUrl = botRoot + "/horizontal_one_box_per_builder"; + +function updateStatus(status) { + var div = document.getElementById("status"); + div.title = status; + var open = /open/i; + if (open.exec(status)) { + div.innerHTML = "tree: open "; + div.className = "open"; + } else { + div.innerHTML = "tree: closed"; + div.className = "closed"; + } +} + +function requestStatus() { + var bots = document.getElementById("bots"); + if (bots) { + // TODO(erikkay): this generates "Unsafe JavaScript attempt to access frame + // with URL" + bots.src = botUrl + "?xxx=" + (new Date()).getTime(); + } + var xhr = new XMLHttpRequest(); + try { + xhr.onreadystatechange = function(state) { + if (xhr.readyState == 4) { + var text = xhr.responseText; + var re = /"Notice"[^>]*>([^<\n]+)</g; + var results = re.exec(text); + if (results && results.index >= 0) { + updateStatus(results[1]); + } else { + console.log("Error: couldn't find node"); + } + } + } + + xhr.onerror = function(error) { + console.log("xhr error: " + error); + } + + xhr.open("GET", "http://chromium-status.appspot.com/current"); + xhr.send({}); + } catch(e) { + console.log("exception: " + e); + } + setTimeout(requestStatus, 30000); +} + +function statusClick() { + window.open(botRoot); +} + +requestStatus(); +</script> +<style> +#main { + /* TODO(erikkay) this shouldn't be necessary, see extensions_toolstrip.css */ + white-space: nowrap; + padding-top: 0px; + height: 100%; +} + +.open { + color: green; +} + +.closed { + color: red; +} + +.button { + padding: 2px 5px; + height: 20px; + float: left; + display: table; +} + +.button:hover { + padding: 0px 4px; + border: 1px solid silver; + -webkit-border-radius: 5px; + background-color: rgb(237, 244, 252); + cursor: pointer; +} + +#bots { + border: 1px solid rgb(237, 244, 252); + height: 20px; /* hardcoded height sucks */ + width: 435px; /* hardcoded width sucks */ + background-color: transparent; +} + +#status { + display: table-cell; + vertical-align: middle; +} + +</style> + +<div id="main"> +<div class="button" onclick="statusClick();"> +<div id="status" class="open"> +tree: open? +</div> +</div> +<iframe scrolling='no' id='bots' src="http://build.chromium.org/buildbot/waterfall/horizontal_one_box_per_builder"></iframe> +</div> diff --git a/chrome/test/data/extensions/buildbot/manifest.json b/chrome/test/data/extensions/buildbot/manifest.json new file mode 100644 index 0000000..7c52761 --- /dev/null +++ b/chrome/test/data/extensions/buildbot/manifest.json @@ -0,0 +1,6 @@ +{
+ "name": "buildbot",
+ "description": "Buildbot waterfall monitor",
+ "version": "0.1",
+ "toolstrips": ["buildbot.html"]
+}
|