public void test35_ultimate_community_fetchArchive()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);
            HdStore store = HdStore.Instance;
            store.Purge();
            _objHd4.IsDownloadableFiles = true;
            dynamic result = _objHd4.CommunityFetchArchive();
            Dictionary<string, dynamic> data = _objHd4.GetReply();

            Assert.IsTrue(result);

            //TODO: to check and show bytes get
        }
        public void test36_ultimate_community_deviceDetectHTTPDesktop()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            Dictionary<string, dynamic> header = new Dictionary<string, dynamic>(){
            {"User-Agent","Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36"}
            };

            bool result = _objHd4.DeviceDetect(header);
            Dictionary<string, dynamic> data = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, data["status"]);
            Assert.AreEqual("OK", data["message"]);
            Assert.AreEqual("", data["hd_specs"]["general_type"]);
        }
        public void test33_ultimate_deviceDetectBIiOS()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            Dictionary<string, dynamic> buildInfo = new Dictionary<string, dynamic>();
            buildInfo.Add("utsname.machine", "iphone4,1");
            buildInfo.Add("utsname.brand", "Apple");

            bool result = _objHd4.DeviceDetect(buildInfo);
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);

            Assert.AreEqual("Mobile", reply["hd_specs"]["general_type"]);
            Assert.AreEqual("Apple", reply["hd_specs"]["general_vendor"]);
            Assert.AreEqual("iPhone 4S", reply["hd_specs"]["general_model"]);
            Assert.AreEqual("iOS", reply["hd_specs"]["general_platform"]);
            Assert.AreEqual("5.0", reply["hd_specs"]["general_platform_version"]);
        }
        public void test34_ultimate_deviceDetectWindowsPhone()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            Dictionary<string, dynamic> buildInfo = new Dictionary<string, dynamic>();
            buildInfo.Add("devicemanufacturer", "nokia");
            buildInfo.Add("devicename", "RM-875");

            bool result = _objHd4.DeviceDetect(buildInfo);
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);

            Assert.AreEqual("Mobile", reply["hd_specs"]["general_type"]);
            Assert.AreEqual("Nokia", reply["hd_specs"]["general_vendor"]);
            Assert.AreEqual("Lumia 1020", reply["hd_specs"]["general_model"]);
            Assert.AreEqual("Windows Phone", reply["hd_specs"]["general_platform"]);
            Assert.AreEqual(332, reply["hd_specs"]["display_ppi"]);
        }
        public void test31_ultimate_deviceDetectHTTPFBiOS()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            Dictionary<string, dynamic> header = new Dictionary<string, dynamic>(){
            {"User-Agent","Mozilla/5.0 (iPhone; CPU iPhone OS 7_1_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Mobile/11D201 [FBAN/FBIOS;FBAV/9.0.0.25.31;FBBV/2102024;FBDV/iPhone6,2;FBMD/iPhone;FBSN/iPhone OS;FBSV/7.1.1;FBSS/2; FBCR/vodafoneIE;FBID/phone;FBLC/en_US;FBOP/5]"}
            };
            header.Add("Accept-Language", "da, en-gb;q=0.8, en;q=0.7");

            bool result = _objHd4.DeviceDetect(header);
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);

            Assert.AreEqual("Mobile", reply["hd_specs"]["general_type"]);
            Assert.AreEqual("Apple", reply["hd_specs"]["general_vendor"]);
            Assert.AreEqual("iPhone 5S", reply["hd_specs"]["general_model"]);
            Assert.AreEqual("iOS", reply["hd_specs"]["general_platform"]);
            Assert.AreEqual("7.1.1", reply["hd_specs"]["general_platform_version"]);
            Assert.AreEqual("da", reply["hd_specs"]["general_language"]);
            Assert.AreEqual("Danish", reply["hd_specs"]["general_language_full"]);
            Assert.AreEqual("Facebook", reply["hd_specs"]["general_app"]);
            Assert.AreEqual("9.0", reply["hd_specs"]["general_app_version"]);
            Assert.AreEqual("", reply["hd_specs"]["general_browser"]);
            Assert.AreEqual("", reply["hd_specs"]["general_browser_version"]);

            Dictionary<string, dynamic> handsetSpecs = reply["hd_specs"];
            Assert.AreEqual(true, handsetSpecs.ContainsKey("display_pixel_ratio"));
            Assert.AreEqual(true, handsetSpecs.ContainsKey("display_ppi"));
            Assert.AreEqual(true, handsetSpecs.ContainsKey("benchmark_min"));
            Assert.AreEqual(true, handsetSpecs.ContainsKey("benchmark_max"));
        }
        public void test32_ultimate_deviceDetectBIAndroid()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            Dictionary<string, dynamic> buildInfo = new Dictionary<string, dynamic>();
            buildInfo.Add("ro.build.PDA", "I9500XXUFNE7");
            buildInfo.Add("ro.build.changelist", "699287");
            buildInfo.Add("ro.build.characteristics", "phone");
            buildInfo.Add("ro.build.date.utc", "1401287026");
            buildInfo.Add("ro.build.date", "Wed May 28 23:23:46 KST 2014");
            buildInfo.Add("ro.build.description", "ja3gxx-user 4.4.2 KOT49H I9500XXUFNE7 release-keys");
            buildInfo.Add("ro.build.display.id", "KOT49H.I9500XXUFNE7");
            buildInfo.Add("ro.build.fingerprint", "samsung/ja3gxx/ja3g:4.4.2/KOT49H/I9500XXUFNE7:user/release-keys");
            buildInfo.Add("ro.build.hidden_ver", "I9500XXUFNE7");
            buildInfo.Add("ro.build.host", "SWDD5723");
            buildInfo.Add("ro.build.id", "KOT49H");
            buildInfo.Add("ro.build.product", "ja3g");
            buildInfo.Add("ro.build.tags", "release-keys");
            buildInfo.Add("ro.build.type", "user");
            buildInfo.Add("ro.build.user", "dpi");
            buildInfo.Add("ro.build.version.codename", "REL");
            buildInfo.Add("ro.build.version.incremental", "I9500XXUFNE7");
            buildInfo.Add("ro.build.version.release", "4.4.2");
            buildInfo.Add("ro.build.version.sdk", "19");
            buildInfo.Add("ro.product.board", "universal5410");
            buildInfo.Add("ro.product.brand", "samsung");
            buildInfo.Add("ro.product.cpu.abi2", "armeabi");
            buildInfo.Add("ro.product.cpu.abi", "armeabi-v7a");
            buildInfo.Add("ro.product.device", "ja3g");
            buildInfo.Add("ro.product.locale.language", "en");
            buildInfo.Add("ro.product.locale.region", "GB");
            buildInfo.Add("ro.product.manufacturer", "samsung");
            buildInfo.Add("ro.product.model", "GT-I9500");
            buildInfo.Add("ro.product.name", "ja3gxx");
            buildInfo.Add("ro.product_ship", "true");

            bool result = _objHd4.DeviceDetect(buildInfo);
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);

            Assert.AreEqual("Mobile", reply["hd_specs"]["general_type"]);
            Assert.AreEqual("Samsung", reply["hd_specs"]["general_vendor"]);
            Assert.AreEqual("GT-I9500", reply["hd_specs"]["general_model"]);
            Assert.AreEqual("Android", reply["hd_specs"]["general_platform"]);
            // Assert.AreEqual("4.4.2", reply["hd_specs"]["general_platform_version"]);
            Assert.AreEqual("Samsung Galaxy S4", reply["hd_specs"]["general_aliases"][0]);
        }
        public void test25_ultimate_deviceDetectHTTPWii()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            Dictionary<string, dynamic> header = new Dictionary<string, dynamic>(){
            {"User-Agent","Opera/9.30 (Nintendo Wii; U; ; 2047-7; es-Es)"}
            };

            bool result = _objHd4.DeviceDetect(header);
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);
            Assert.AreEqual("Console", reply["hd_specs"]["general_type"]);
        }
        public void test30_ultimate_deviceDetectHTTPHardwareInfoC()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            Dictionary<string, dynamic> header = new Dictionary<string, dynamic>(){
            {"User-Agent","Mozilla/5.0 (iPhone; U; CPU iPhone OS 2_0 like Mac OS X; en-gb) AppleWebKit/533.17.9 (KHTML, like Gecko)"}
            };
            header.Add("x-local-hardwareinfo", "320:480:200:1200");

            bool result = _objHd4.DeviceDetect(header);
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);

            Assert.AreEqual("Mobile", reply["hd_specs"]["general_type"]);
            Assert.AreEqual("Apple", reply["hd_specs"]["general_vendor"]);
            Assert.AreEqual("iPhone 3G", reply["hd_specs"]["general_model"]);
            Assert.AreEqual("iOS", reply["hd_specs"]["general_platform"]);
            Assert.AreEqual("2.0", reply["hd_specs"]["general_platform_version"]);
            Assert.AreEqual("en-gb", reply["hd_specs"]["general_language"]);

            Dictionary<string, dynamic> handsetSpecs = reply["hd_specs"];
            Assert.AreEqual(true, handsetSpecs.ContainsKey("display_pixel_ratio"));
            Assert.AreEqual(true, handsetSpecs.ContainsKey("display_ppi"));
            Assert.AreEqual(true, handsetSpecs.ContainsKey("benchmark_min"));
            Assert.AreEqual(true, handsetSpecs.ContainsKey("benchmark_max"));
        }
        public void test22_ultimate_deviceDeviceWhatHas()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            bool result = _objHd4.DeviceWhatHas("design_dimensions", "101 x 44 x 16");
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);

            dynamic jsonString = _jss.Serialize(reply["devices"]);

            Assert.AreEqual(true, Regex.IsMatch(jsonString, "Asus"));
            Assert.AreEqual(true, Regex.IsMatch(jsonString, "V80"));
            Assert.AreEqual(true, Regex.IsMatch(jsonString, "Spice"));
            Assert.AreEqual(true, Regex.IsMatch(jsonString, "S900"));
            Assert.AreEqual(true, Regex.IsMatch(jsonString, "Voxtel"));
            Assert.AreEqual(true, Regex.IsMatch(jsonString, "RX800"));
        }
Exemple #10
0
        public void test24_ultimate_deviceDetectHTTPDesktopJunk()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            Dictionary<string, dynamic> header = new Dictionary<string, dynamic>(){
            {"User-Agent","aksjakdjkjdaiwdidjkjdkawjdijwidawjdiajwdkawdjiwjdiawjdwidjwakdjajdkad"}

            };
            bool result = _objHd4.DeviceDetect(header);
            Dictionary<string, dynamic> reply = _objHd4.GetReply();
            Assert.IsFalse(result);
            Assert.AreEqual(301, reply["status"]);
            Assert.AreEqual("Not Found", reply["message"]);
        }
Exemple #11
0
        public void test21_ultimate_deviceView()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            bool result = _objHd4.DeviceView("Nokia", "N95");
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);
            Assert.AreEqual(_jss.Serialize(_devices["NokiaN95"]), _jss.Serialize(reply["device"]));
        }
Exemple #12
0
        public void test20_ultimate_deviceModels()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            bool result = _objHd4.DeviceModels("Nokia");
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);
            Assert.IsNotEmpty(reply["message"]);
            Assert.Greater(reply["model"].Count, 700);
        }
Exemple #13
0
        public void test19_ultimate_deviceVendors()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            bool result = _objHd4.DeviceVendors();
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, reply["status"]);
            Assert.AreEqual("OK", reply["message"]);
            Assert.Contains("Nokia", reply["vendor"]);
            Assert.Contains("Samsung", reply["vendor"]);
        }
Exemple #14
0
        public void test18_fetchArchive()
        {
            // Note : request storage dir to be created if it does not exist. (with TRUE as 2nd param)

            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);
            HdStore store = HdStore.Instance;
            store.Purge();
            dynamic result = _objHd4.DeviceFetchArchive();
            Dictionary<string, dynamic> reply = _objHd4.GetReply();

            Assert.IsTrue(result);
            //TODO: to get no. bytes
        }
Exemple #15
0
        public void test40_ultimate_community_deviceDetectHTTPOtherHeader()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _ultimateConfig);

            Dictionary<string, dynamic> header = new Dictionary<string, dynamic>(){
            {"User-Agent","blahblahblah"}
            };
            header.Add("x-fish-header", "Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3 like Mac OS X; en-gb) AppleWebKit/533.17.9 (KHTML, like Gecko)");

            bool result = _objHd4.DeviceDetect(header);
            Dictionary<string, dynamic> data = _objHd4.GetReply();

            Assert.IsTrue(result);
            Assert.AreEqual(0, data["status"]);
            Assert.AreEqual("OK", data["message"]);
            Assert.AreEqual("", data["hd_specs"]["general_type"]);

            Assert.AreEqual("", data["hd_specs"]["general_type"]);
            Assert.AreEqual("Apple", data["hd_specs"]["general_vendor"]);
            Assert.AreEqual("iPhone", data["hd_specs"]["general_model"]);
            Assert.AreEqual("iOS", data["hd_specs"]["general_platform"]);
            Assert.AreEqual("4.3", data["hd_specs"]["general_platform_version"]);
            Assert.AreEqual("en-gb", data["hd_specs"]["general_language"]);
            Assert.AreEqual("", data["hd_specs"]["general_type"]);

            Dictionary<string, dynamic> handsetSpecs = data["hd_specs"];
            Assert.AreEqual(true, handsetSpecs.ContainsKey("display_pixel_ratio"));
            Assert.AreEqual(true, handsetSpecs.ContainsKey("display_ppi"));
            Assert.AreEqual(true, handsetSpecs.ContainsKey("benchmark_min"));
            Assert.AreEqual(true, handsetSpecs.ContainsKey("benchmark_max"));
        }