Sha256: 217b32a10262ba5564f5a2f0e48456726afeb270f1caae50a6def7eae44c3d1d

Contents?: true

Size: 1.76 KB

Versions: 2

Compression:

Stored size: 1.76 KB

Contents

# frozen_string_literal: true

require "test_helper"

class ChromeTest < Minitest::Test
  test "detects chrome" do
    browser = Browser.new(Browser["CHROME"])

    assert_equal "Chrome", browser.name
    assert browser.chrome?
    refute browser.safari?
    assert browser.webkit?
    assert browser.modern?
    assert_equal "5.0.375.99", browser.full_version
    assert_equal "5", browser.version
  end

  test "detects mobile chrome" do
    browser = Browser.new(Browser["MOBILE_CHROME"])

    assert_equal "Chrome", browser.name
    assert browser.chrome?
    refute browser.safari?
    assert browser.webkit?
    assert browser.modern?
    assert_equal "19.0.1084.60", browser.full_version
    assert_equal "19", browser.version
  end

  test "detects samsung chrome" do
    browser = Browser.new(Browser["SAMSUNG_CHROME"])

    assert_equal "Chrome", browser.name
    assert browser.chrome?
    assert browser.platform.android?
    refute browser.safari?
    assert browser.webkit?
    assert browser.modern?
    assert_equal "28.0.1500.94", browser.full_version
    assert_equal "28", browser.version
  end

  test "detects chrome os" do
    browser = Browser.new(Browser["CHROME_OS"])
    assert browser.platform.chrome_os?
  end

  test "detects chrome frame" do
    browser = Browser.new(Browser["IE9_CHROME_FRAME"])

    assert browser.chrome?
    refute browser.safari?
    assert browser.webkit?
    assert_equal "26.0.1410.43", browser.full_version
    assert_equal "26", browser.version
  end

  test "detects chrome not opera when android build number contains 'OPR'" do
    browser = Browser.new(Browser["ANDROID_OREO"])

    assert browser.chrome?
  end

  test "detects version by range" do
    browser = Browser.new(Browser["CHROME"])
    assert browser.chrome?(%w[>=5 <6])
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
browser-2.7.1 test/unit/chrome_test.rb
browser-2.7.0 test/unit/chrome_test.rb