protected void Page_Load(object sender, EventArgs e)
        {
            // Ensure config file is setup
            if (!File.Exists(Server.MapPath(ConfigFile)))
            {
                throw new Exception("Config file not found");
            }

            var serializer = new JavaScriptSerializer();
            string jsonText = System.IO.File.ReadAllText(Server.MapPath(ConfigFile));
            Config = serializer.Deserialize<Dictionary<string, dynamic>>(jsonText);

            if (Config["username"] == "your_api_username")
            {
                throw new Exception("Please configure your username, secret and site_id");
            }

            ObjHd4 = new Hd4(Request, ConfigFile);

            // Models example : Get a list of all models for a specific vendor
            Response.Write("<h1>Nokia Models</h1><p>");
            if (ObjHd4.DeviceModels("Nokia"))
            {
                Response.Write(ObjHd4.GetRawReply());
            }
            else
            {
                Response.Write(ObjHd4.GetError());
            }
            Response.Write("</p>");
        }
 public void SetUpBeforeClass()
 {
     if (_isCommunitySetupDone)
     {
         HttpRequest request       = new HttpRequest(null, "http://localhost", null);
         Hd4         objHd4        = new Hd4(request, "/hdCloudConfig.json");
         string      directoryPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
         string      filePath      = directoryPath + "\\" + "communityTest.zip";
         _store = HdStore.Instance;
         _store.SetPath(directoryPath, true);
         objHd4.CommunityFetchArchive();
         _isCommunitySetupDone = false;
     }
 }
 public void SetUpBeforeClass()
 {
     if (_isCommunitySetupDone)
     {
         HttpRequest request = new HttpRequest(null, "http://localhost", null);
         Hd4 objHd4 = new Hd4(request, "/hdCloudConfig.json");
         string directoryPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
         string filePath = directoryPath + "\\" + "communityTest.zip";
         _store = HdStore.Instance;
         _store.SetPath(directoryPath, true);
           objHd4.CommunityFetchArchive();
         _isCommunitySetupDone = false;
     }
 }
        public void FlyThrough(Hd4 objHd)
        {
            var deviceModelList = new List<DeviceModel>();
            TotalCount = 1;
            Stopwatch stopwatch = new Stopwatch();
            stopwatch.Reset();
            stopwatch.Start();
            foreach (var header in _headers)
            {
                var result = objHd.DeviceDetect(header);
                TotalCount++;

            }

            stopwatch.Stop();
            TotalMilliSec = stopwatch.ElapsedMilliseconds;

            grdDeviceModel.DataSource = deviceModelList;
            grdDeviceModel.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            // Ensure config file is setup
            if (!File.Exists(Server.MapPath(ConfigFile)))
            {
                throw new Exception("Config file not found");
            }

            var serializer = new JavaScriptSerializer();
            string jsonText = System.IO.File.ReadAllText(Server.MapPath(ConfigFile));
            Config = serializer.Deserialize<Dictionary<string, dynamic>>(jsonText);

            if (Config["username"] == "your_api_username")
            {
                throw new Exception("Please configure your username, secret and site_id");
            }

            ObjHd4 = new Hd4(Request, ConfigFile);

            // This manually sets the headers that a Nokia N95 would set.
            // Other agents you also might like to try
            // Mozilla/5.0 (BlackBerry; U; BlackBerry 9300; es) AppleWebKit/534.8+ (KHTML, like Gecko) Version/6.0.0.534 Mobile Safari/534.8+
            // Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95-3/20.2.011 Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413
            // Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5
            Response.Write("<h1>Simple Detection - Setting Headers for an N95</h1><p>");
             //   objHD4.setDetectVar("user-agent","Mozilla/5.0 (SymbianOS/9.2; U; Series60/3.1 NokiaN95-3/20.2.011 Profile/MIDP-2.0 Configuration/CLDC-1.1 ) AppleWebKit/413");
            //objHD4.setDetectVar("x-wap-profile","http://nds1.nds.nokia.com/uaprof/NN95-1r100.xml");
            //if (objHD4.siteDetect())
            //{
            //    Response.Write(objHD4.getRawReply());
            //}
            //else
            //{
            //    Response.Write(objHD4.getError());
            //}
            Response.Write("</p>");
        }
        protected void Page_Load(dynamic sender, EventArgs e)
        {
            var fileName = "/benchmarkData.txt";
            try
            {
                if (File.Exists(Server.MapPath(fileName)))
                {
                    using (var sr = new StreamReader(Server.MapPath(fileName)))
                    {
                        string line;

                        while ((line = sr.ReadLine()) != null)
                        {
                            var item = line.Trim().Split(new[] { "|" }, StringSplitOptions.None);
                            var requestBody = new Dictionary<string, dynamic>();
                            requestBody["user-agent"] = item[0];
                            if (item.Length > 1)
                            {
                                requestBody["x-wap-profile"] = item[1];
                            }
                            else
                            {
                                requestBody["x-wap-profile"] = string.Empty;
                            }
                            _headers.Add(requestBody);

                        }
                    }
                }
                else
                {
                    Response.Write("File not exist.");
                }
            }
            catch (Exception ex)
            {
                Response.Write("File error: " + ex.Message);
            }
            var objHd = new Hd4(Request);

            FlyThrough(objHd);
            lblTotDetect.Text = TotalCount.ToString();
            lblTimeElapsed.Text = (TotalMilliSec / 1000).ToString(CultureInfo.InvariantCulture) + " sec.";
            lblDetectPerSec.Text = ((Convert.ToDouble(TotalCount) * 1000) / TotalMilliSec).ToString(CultureInfo.InvariantCulture);
        }
Example #7
0
        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"]);
        }
Example #8
0
        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
        }
Example #9
0
        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"]);
        }
Example #10
0
        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"]);
        }
Example #11
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"]);
        }
Example #12
0
        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"));
        }
Example #13
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"]);
        }
Example #14
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"]);
        }
Example #15
0
        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"));
        }
Example #16
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"]));
        }
Example #17
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);
        }
Example #18
0
        public void test0_initialSetup()
        {
            HttpRequest request = new HttpRequest(null, "http://localhost", null);
            _objHd4 = new Hd4(request, _cloudConfig);

            if (!_devices.ContainsKey("NokiaN95"))
            {
                string noikaN95JsonText = "{\"general_vendor\":\"Nokia\",\"general_model\":\"N95\",\"general_platform\":\"Symbian\",\"general_platform_version\":\"9.2\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_image\":\"nokian95-1403496370-0.gif\",\"general_aliases\":[],\"general_eusar\":\"0.50\",\"general_battery\":[\"Li-Ion 950 mAh\",\"BL-5F\"],\"general_type\":\"Mobile\",\"general_cpu\":[\"Dual ARM 11\",\"332MHz\"],\"design_formfactor\":\"Dual Slide\",\"design_dimensions\":\"99 x 53 x 21\",\"design_weight\":\"120\",\"design_antenna\":\"Internal\",\"design_keyboard\":\"Numeric\",\"design_softkeys\":\"2\",\"design_sidekeys\":[\"Volume\",\"Camera\"],\"display_type\":\"TFT\",\"display_color\":\"Yes\",\"display_colors\":\"16M\",\"display_size\":\"2.6\\\"\",\"display_x\":\"240\",\"display_y\":\"320\",\"display_other\":[],\"memory_internal\":[\"160MB\",\"64MB RAM\",\"256MB ROM\"],\"memory_slot\":[\"microSD\",\"8GB\",\"128MB\"],\"network\":[\"GSM850\",\"GSM900\",\"GSM1800\",\"GSM1900\",\"UMTS2100\",\"HSDPA2100\",\"Infrared\",\"Bluetooth 2.0\",\"802.11b\",\"802.11g\",\"GPRS Class 10\",\"EDGE Class 32\"],\"media_camera\":[\"5MP\",\"2592x1944\"],\"media_secondcamera\":[\"QVGA\"],\"media_videocapture\":[\"VGA@30fps\"],\"media_videoplayback\":[\"MPEG4\",\"H.263\",\"H.264\",\"3GPP\",\"RealVideo 8\",\"RealVideo 9\",\"RealVideo 10\"],\"media_audio\":[\"MP3\",\"AAC\",\"AAC+\",\"eAAC+\",\"WMA\"],\"media_other\":[\"Auto focus\",\"Video stabilizer\",\"Video calling\",\"Carl Zeiss optics\",\"LED Flash\"],\"features\":[\"Unlimited entries\",\"Multiple numbers per contact\",\"Picture ID\",\"Ring ID\",\"Calendar\",\"Alarm\",\"To-Do\",\"Document viewer\",\"Calculator\",\"Notes\",\"UPnP\",\"Computer sync\",\"VoIP\",\"Music ringtones (MP3)\",\"Vibration\",\"Phone profiles\",\"Speakerphone\",\"Accelerometer\",\"Voice dialing\",\"Voice commands\",\"Voice recording\",\"Push-to-Talk\",\"SMS\",\"MMS\",\"Email\",\"Instant Messaging\",\"Stereo FM radio\",\"Visual radio\",\"Dual slide design\",\"Organizer\",\"Word viewer\",\"Excel viewer\",\"PowerPoint viewer\",\"PDF viewer\",\"Predictive text input\",\"Push to talk\",\"Voice memo\",\"Games\"],\"connectors\":[\"USB\",\"MiniUSB\",\"3.5mm Audio\",\"TV Out\"],\"general_platform_version_max\":\"\",\"general_app\":\"\",\"general_app_version\":\"\",\"general_language\":\"\",\"display_ppi\":154,\"display_pixel_ratio\":\"1.0\",\"benchmark_min\":0,\"benchmark_max\":0,\"general_app_category\":\"\",\"general_virtual\":0}";
                _devices.Add("NokiaN95", _jss.Deserialize<Dictionary<string, dynamic>>(noikaN95JsonText));
            }
        }
Example #19
0
        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"));
        }
Example #20
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
        }
Example #21
0
        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]);
        }
Example #22
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"));
        }