Sha256: 44ebd38280cef7f3d33cc159a10293109fec15390b3928ab281799a8b9bd2f7c

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

require File.expand_path(File.join(File.dirname(__FILE__),'..','..','..','test_helper'))

class NewRelic::Agent::Instrumentation::BrowserMonitoringTimingsTest < Test::Unit::TestCase

  def setup
    Time.stubs(:now).returns(2000)
    @transaction = stub(
      :transaction_name => "Name",
      :start_time => 0
    )
  end

  def test_queue_time
    t = NewRelic::Agent::Instrumentation::BrowserMonitoringTimings.new(1000.1234, @transaction)
    assert_equal 1_000_123, t.queue_time_in_millis
  end

  def test_queue_time_clamps_to_positive
    t = NewRelic::Agent::Instrumentation::BrowserMonitoringTimings.new(-1000, @transaction)
    assert_equal 0, t.queue_time_in_millis
  end

  def test_app_time
    t = NewRelic::Agent::Instrumentation::BrowserMonitoringTimings.new(nil, @transaction)
    assert_equal 2_000_000, t.app_time_in_millis
  end

  def test_transaction_name
    t = NewRelic::Agent::Instrumentation::BrowserMonitoringTimings.new(nil, @transaction)
    assert_equal "Name", t.transaction_name
  end

  def test_defaults_to_transaction_info
    t = NewRelic::Agent::Instrumentation::BrowserMonitoringTimings.new(1000, nil)
    assert_equal nil, t.transaction_name
    assert_equal 0.0, t.start_time_in_millis
  end

end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
newrelic_rpm-3.5.5.39.beta test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb
wd_newrelic_rpm-3.5.5 test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb
newrelic_rpm-3.5.5.38 test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb
newrelic_rpm-3.5.5.540.dev test/new_relic/agent/instrumentation/browser_monitoring_timings_test.rb