Sha256: af3583a22fc3d155fb6a8a56ac4319f91c1925f814c26fd530fc3058be07eed3

Contents?: true

Size: 1.88 KB

Versions: 12

Compression:

Stored size: 1.88 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_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_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_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 chrome on android 10" do
    browser = Browser.new(Browser["ANDROID_Q"])

    assert browser.chrome?
    assert_equal "Chrome", browser.name
    assert_equal "78", browser.version
  end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
browser-5.3.1 test/unit/chrome_test.rb
browser-5.3.0 test/unit/chrome_test.rb
browser-5.2.0 test/unit/chrome_test.rb
browser-5.1.0 test/unit/chrome_test.rb
browser-5.0.0 test/unit/chrome_test.rb
browser-4.2.0 test/unit/chrome_test.rb
browser-4.1.0 test/unit/chrome_test.rb
browser-4.0.0 test/unit/chrome_test.rb
browser-3.0.3 test/unit/chrome_test.rb
browser-3.0.2 test/unit/chrome_test.rb
browser-3.0.1 test/unit/chrome_test.rb
browser-3.0.0 test/unit/chrome_test.rb