summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authorerikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-11 15:16:45 +0000
committererikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-11 15:16:45 +0000
commitadc2ccf7987a58fb73f2749d98cd49aae56c3700 (patch)
treea93b3de0ef8455799068ee77ce907a2635ccd033 /chrome/test
parent6c3b5326b5e35d548f96496810164e596d7b210e (diff)
downloadchromium_src-adc2ccf7987a58fb73f2749d98cd49aae56c3700.zip
chromium_src-adc2ccf7987a58fb73f2749d98cd49aae56c3700.tar.gz
chromium_src-adc2ccf7987a58fb73f2749d98cd49aae56c3700.tar.bz2
add mole collapse/expand events. convert mappy to use this.
BUG=15494 TEST=browser_tests.exe --gtest_filter=ExtensionApiTest.Toolstrip Review URL: http://codereview.chromium.org/203023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25976 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rwxr-xr-xchrome/test/data/extensions/api_test/toolstrip/manifest.json6
-rwxr-xr-xchrome/test/data/extensions/api_test/toolstrip/test.html14
-rwxr-xr-xchrome/test/data/extensions/samples/mappy/mappy_toolstrip.html34
3 files changed, 51 insertions, 3 deletions
diff --git a/chrome/test/data/extensions/api_test/toolstrip/manifest.json b/chrome/test/data/extensions/api_test/toolstrip/manifest.json
new file mode 100755
index 0000000..36ed6e8
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/toolstrip/manifest.json
@@ -0,0 +1,6 @@
+{
+ "name": "chrome.toolstrip",
+ "version": "0.1",
+ "description": "end-to-end browser test for chrome.toolstrip API",
+ "toolstrips": ["test.html"]
+}
diff --git a/chrome/test/data/extensions/api_test/toolstrip/test.html b/chrome/test/data/extensions/api_test/toolstrip/test.html
new file mode 100755
index 0000000..237612d
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/toolstrip/test.html
@@ -0,0 +1,14 @@
+<script>
+chrome.test.runTests([
+ function expand() {
+ chrome.test.listenOnce(chrome.toolstrip.onExpanded, function(){});
+ chrome.toolstrip.expand({height:200},
+ chrome.test.callbackPass(function(){}));
+ },
+
+ function collapse() {
+ chrome.test.listenOnce(chrome.toolstrip.onCollapsed, function(){});
+ chrome.toolstrip.collapse({}, chrome.test.callbackPass(function(){}));
+ }
+]);
+</script>
diff --git a/chrome/test/data/extensions/samples/mappy/mappy_toolstrip.html b/chrome/test/data/extensions/samples/mappy/mappy_toolstrip.html
index 096b1e3..9573344 100755
--- a/chrome/test/data/extensions/samples/mappy/mappy_toolstrip.html
+++ b/chrome/test/data/extensions/samples/mappy/mappy_toolstrip.html
@@ -1,8 +1,36 @@
+<style>
+#map {
+ display: none;
+ width: 512px;
+ height: 512px;
+}
+</style>
<script src="http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAATfHumDbW3OmRByfquHd3SRTRERdeAiwZ9EeJWta3L_JZVS0bOBRQeZgr4K0xyVKzUdnnuFl8X9PX0w&sensor=false"
type="text/javascript"></script>
<script>
var maps_key = "ABQIAAAATfHumDbW3OmRByfquHd3SRTRERdeAiwZ9EeJWta3L_JZVS0bOBRQeZgr4K0xyVKzUdnnuFl8X9PX0w";
+chrome.toolstrip.onCollapsed.addListener(function() {
+ var map = document.getElementById("map");
+ map.src = "";
+ map.style.display = "none";
+ var button = document.getElementById("button");
+ button.style.display = "block";
+});
+
+function expand(url) {
+ var button = document.getElementById("button");
+ button.style.display = "none";
+ var map = document.getElementById("map");
+ map.src = url;
+ map.style.display = "block";
+ chrome.toolstrip.expand({height:512}, function() {});
+}
+
+function collapse() {
+ chrome.toolstrip.collapse({}, function() {});
+}
+
function gclient_geocode(address) {
var geocoder = new GClientGeocoder();
geocoder.getLatLng(address, function(point) {
@@ -13,8 +41,7 @@ function gclient_geocode(address) {
var url = "http://maps.google.com/staticmap?center=" + latlng +
"&markers=" + latlng + "&zoom=14" +
"&size=512x512&sensor=false&key=" + maps_key;
- document.body.style.width = "512px";
- setTimeout(chrome.toolstrip.expand, 100, {height:512, url:url});
+ expand(url);
}
});
}
@@ -34,6 +61,7 @@ function map() {
});
};
</script>
-<div class="toolstrip-button" onclick="map()">
+<div id="button" class="toolstrip-button" onclick="map()">
<span>Mappy</span>
</div>
+<img id="map" onclick="collapse()">