aboutsummaryrefslogtreecommitdiff
path: root/contexts/data/lib/closure-library/closure/goog/useragent/platform_test.html
diff options
context:
space:
mode:
Diffstat (limited to 'contexts/data/lib/closure-library/closure/goog/useragent/platform_test.html')
-rw-r--r--contexts/data/lib/closure-library/closure/goog/useragent/platform_test.html115
1 files changed, 0 insertions, 115 deletions
diff --git a/contexts/data/lib/closure-library/closure/goog/useragent/platform_test.html b/contexts/data/lib/closure-library/closure/goog/useragent/platform_test.html
deleted file mode 100644
index 083b81f..0000000
--- a/contexts/data/lib/closure-library/closure/goog/useragent/platform_test.html
+++ /dev/null
@@ -1,115 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-Copyright 2010 The Closure Library Authors. All Rights Reserved.
-
-Use of this source code is governed by the Apache License, Version 2.0.
-See the COPYING file for details.
--->
-<!--
-
- @author mpd@google.com (Michael Davidson)
--->
-<head>
-<meta http-equiv="X-UA-Compatible" content="IE=edge">
-<title>Closure Unit Tests - goog.userAgent.platform</title>
-<script src="../base.js"></script>
-<script>
- goog.require('goog.array');
- goog.require('goog.testing.jsunit');
- goog.require('goog.testing.MockUserAgent');
- goog.require('goog.testing.PropertyReplacer');
- goog.require('goog.userAgent.platform');
-</script>
-</head>
-<body>
-<script>
- var mockAgent;
-
- function setUp() {
- mockAgent = new goog.testing.MockUserAgent();
- mockAgent.install();
- }
-
- function tearDown() {
- mockAgent.dispose();
- updateUserAgentUtils();
- }
-
- function updateUserAgentUtils() {
- goog.userAgent.PLATFORM = goog.userAgent.determinePlatform_();
- goog.userAgent.initPlatform_();
-
- // Unfortunately we can't isolate the useragent setting in a function
- // we can call, because things rely on it compiling to nothing when
- // one of the ASSUME flags is set, and the compiler isn't smart enough
- // to do that when the setting is done inside a function that's inlined.
- goog.userAgent.MAC = goog.userAgent.detectedMac_;
- goog.userAgent.WINDOWS = goog.userAgent.detectedWindows_;
- goog.userAgent.LINUX = goog.userAgent.detectedLinux_;
- goog.userAgent.X11 = goog.userAgent.detectedX11_;
-
- goog.userAgent.platform.VERSION =
- goog.userAgent.platform.determineVersion_();
- }
-
- function testWindows() {
- mockAgent.setNavigator({platform: 'Win32'});
-
- var win98 = 'Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98; Win 9x 4.90)';
- var win2k = 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 5.0; en-US)';
- var xp = 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 5.1; en-US)';
- var vista = 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.0; en-US)';
- var win7 = 'Mozilla/5.0 (Windows; U; MSIE 7.0; Windows NT 6.1; en-US)';
-
- mockAgent.setUserAgentString(win98);
- updateUserAgentUtils();
- assertEquals("0", goog.userAgent.platform.VERSION);
-
- mockAgent.setUserAgentString(win2k);
- updateUserAgentUtils();
- assertEquals("5.0", goog.userAgent.platform.VERSION);
-
- mockAgent.setUserAgentString(xp);
- updateUserAgentUtils();
- assertEquals("5.1", goog.userAgent.platform.VERSION);
-
- mockAgent.setUserAgentString(vista);
- updateUserAgentUtils();
- assertEquals("6.0", goog.userAgent.platform.VERSION);
-
- mockAgent.setUserAgentString(win7);
- updateUserAgentUtils();
- assertEquals("6.1", goog.userAgent.platform.VERSION);
- }
-
- function testMac() {
- // For some reason Chrome substitutes _ for . in the OS version.
- var chrome = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_8; en-US)" +
- "AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.0.249.49 Safari/532.5";
-
- var ff = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US;" +
- "rv:1.9.1.7) Gecko/20091221 Firefox/3.5.7 GTB6";
-
- // An old camino version that doesn't report a Mac version.
- var camino = "Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en; rv:1.8.1.11)" +
- "Gecko/20071128 Camino/1.5.4";
-
- mockAgent.setNavigator({platform: 'IntelMac'});
-
- mockAgent.setUserAgentString(chrome);
- updateUserAgentUtils();
- assertEquals("10.5.8", goog.userAgent.platform.VERSION);
-
- mockAgent.setUserAgentString(ff);
- updateUserAgentUtils();
- assertEquals("10.5", goog.userAgent.platform.VERSION);
-
- mockAgent.setUserAgentString(camino);
- updateUserAgentUtils();
- assertEquals("10", goog.userAgent.platform.VERSION);
- }
-
-</script>
-</body>
-</html>