Why do you even need automate this? What is the purpose, what do you really need to test at the end? You can't test something what is not yours and if you want to automate testing of browser itself, then, well, you need to work on that browser itself, but even in that case, testing that browser is displaying popup message on screen would require much more complicated tests, maybe making screenshot from OS and comparing it.
You can check which platforms support which APIs online and in code you may just add if
if ("geolocation" in navigator) {
/* geolocation is available */
} else {
/* geolocation IS NOT available */
}