Archive-Har
view release on metacpan or search on metacpan
t/httpwatch_cookies_n_cache.t view on Meta::CPAN
"name" : "Date",
"value" : "Tue, 03 Apr 2012 22:13:49 GMT"
},
{
"name" : "Expires",
"value" : "Tue, 03 Apr 2012 22:13:49 GMT"
},
{
"name" : "Last-Modified",
"value" : "Mon, 02 Apr 2012 02:13:37 GMT"
},
{
"name" : "Server",
"value" : "sffe"
},
{
"name" : "X-Content-Type-Options",
"value" : "nosniff"
},
{
"name" : "X-XSS-Protection",
"value" : "1; mode=block"
}
],
"content" : {
"size" : 1150,
"mimeType" : "image/x-icon",
"text" : "AAABAAEAEBAAAAEAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA7PT7/3zF6/9Ptu//RbHx/0227/+Tzvb/9vv5/97h0f9JeBz/NHoA/z98Av9AfAD/PHsA/0F6AP8AAAAA/vz7/1+33/8Mp+z/FrHw/xWy8f8bs/T/Hqrx/3zE7v////7/...
"encoding" : "base64"
},
"redirectURL" : "",
"headersSize" : 314,
"bodySize" : 1150
},
"cache" : {
"beforeRequest" : null,
"afterRequest" : {
"expires" : "2013-04-03T22:13:49.000Z",
"lastAccess" : "2012-04-03T22:13:53.000Z",
"eTag" : "",
"hitCount" : 5
}
},
"timings" : {
"blocked" : 69,
"dns" : -1,
"connect" : -1,
"send" : 0,
"wait" : 161,
"receive" : 1
},
"serverIPAddress" : "74.125.237.112",
"connection" : "4"
}
]
}
}
_HTTPWATCH_RESULTS_
ok($har->string($httpwatch_gmail_string), "Successfully read firebug har archive for https://accounts.google.com");
my ($firstPage) = $har->pages();
ok($firstPage->page_timings()->_renderStart() == 2928, "INPUT: HttpWatch's archive first page pageTimings for _renderStart is 2928");
eval { $firstPage->page_timings->notInTheSpec() };
ok($@ =~ /notInTheSpec is not specified in the HAR 1.2 spec and does not start with an underscore/, "INPUT: Correct exception thrown for a non-conforming field name:$@");
my ($firstEntry) = $har->entries();
ok($firstEntry->response()->redirect_url() eq 'https://www.google.com/accounts/recovery?hl=en&gaps&service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F', "INPUT: HttpWatch's archive first entry response has a redirectURL of 'https://www.goog...
ok($firstEntry->response()->content()->compression() == 73, "INPUT: HttpWatch's archive first entry response content has a compression of 73");
ok(not(defined $firstEntry->cache()->before_request()), "INPUT: HttpWatch's archive first entry cache has a undefined beforeRequest");
ok($firstEntry->cache()->after_request()->last_access() eq '2012-04-03T22:13:50.000Z', "INPUT: HttpWatch's archive first entry cache has a afterRequest lastAccess of '2012-04-03T22:13:50.000Z'");
ok($firstEntry->cache()->after_request()->etag() eq '', "INPUT: HttpWatch's archive first entry cache has a afterRequest eTag is set to the empty string");
ok($firstEntry->cache()->after_request()->hit_count() == 1, "INPUT: HttpWatch's archive first entry cache has a afterRequest hitCount is equal to 1");
ok(scalar $firstEntry->request()->cookies() == 1, "INPUT: HttpWatch's archive first entry request has a cookie list with 1 entries");
my ($cookie) = $firstEntry->request->cookies();
ok($cookie->name() eq 'PREF', "INPUT: HttpWatch's archive first entry request cookie has a name of 'PREF'");
ok($cookie->value() eq 'ID=31245dd052940995:TM=1333416734:LM=1333416734:S=GVCghq5oz8F4iPqS', "INPUT: HttpWatch's archive first entry request cookie has a value of 'ID=31245dd052940995:TM=1333416734:LM=1333416734:S=GVCghq5oz8F4iPqS'");
ok($cookie->path() eq '/', "INPUT: HttpWatch's archive first entry request cookie has a path of '/'");
ok($cookie->domain() eq '.google.com', "INPUT: HttpWatch's archive first entry request cookie has a domain of '.google.com'");
ok($cookie->expires() eq '2014-04-03T01:32:16.000Z', "INPUT: HttpWatch's archive first entry request cookie has a domain of '2014-04-03T01:32:16.000Z'");
ok((defined $cookie->http_only()) && (not($cookie->http_only())), "INPUT: HttpWatch's archive first entry request cookie has httpOnly set to false");
ok((defined $cookie->secure()) && (not($cookie->secure())), "INPUT: HttpWatch's archive first entry request cookie has secure set to false");
($cookie) = $firstEntry->response()->cookies();
ok($cookie->name() eq 'GAPS', "INPUT: HttpWatch's archive first entry response cookie has a name of 'GAPS'");
ok($cookie->value() eq '1:UXm7kjQDHHUZVCIzJEuqpbo7xhUpSw:pesWZreBW2aeymnv', "INPUT: HttpWatch's archive first entry response cookie has a name of '1:UXm7kjQDHHUZVCIzJEuqpbo7xhUpSw:pesWZreBW2aeymnv'");
ok($cookie->expires() eq '2014-04-03T22:13:46.000Z', "INPUT: HttpWatch's archive first entry response cookie has a expires of '2014-04-03T22:13:46.000Z'");
ok($cookie->path() eq '/', "INPUT: HttpWatch's archive first entry response cookie has a path of '/'");
ok($cookie->http_only(), "INPUT: HttpWatch's archive first entry response cookie has httpOnly set to true");
ok($cookie->secure(), "INPUT: HttpWatch's archive first entry response cookie has secure set to true");
my $firebug_ref = $har->hashref();
ok($firebug_ref->{log}->{pages}->[0]->{pageTimings}->{_renderStart} == 2928, "OUTPUT: HttpWatch's archive first page pageTimings for _renderStart is 2928");
ok($firebug_ref->{log}->{entries}->[0]->{response}->{redirectURL} eq 'https://www.google.com/accounts/recovery?hl=en&gaps&service=mail&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F', "OUTPUT: HttpWatch's archive first entry response has a redirect...
ok($firebug_ref->{log}->{entries}->[0]->{response}->{content}->{compression} == 73, "OUTPUT: HttpWatch's archive first entry response content has a compression of 73");
ok((exists $firebug_ref->{log}->{entries}->[0]->{cache}->{beforeRequest}) && (not(defined $firebug_ref->{log}->{entries}->[0]->{beforeRequest})), "OUTPUT: HttpWatch's archive first entry cache has a undefined beforeRequest");
ok($firebug_ref->{log}->{entries}->[0]->{cache}->{afterRequest}->{lastAccess} eq '2012-04-03T22:13:50.000Z', "OUTPUT: HttpWatch's archive first entry cache has a afterRequest lastAccess of '2012-04-03T22:13:50.000Z'");
ok($firebug_ref->{log}->{entries}->[0]->{cache}->{afterRequest}->{eTag} eq '', "OUTPUT: HttpWatch's archive first entry cache has a afterRequest eTag of ''");
ok($firebug_ref->{log}->{entries}->[0]->{cache}->{afterRequest}->{hitCount} == 1, "OUTPUT: HttpWatch's archive first entry cache has a afterRequest hitCount of 1");
ok(scalar @{$firebug_ref->{log}->{entries}->[0]->{request}->{cookies}} == 1, "OUTPUT: HttpWatch's archive first entry request has a cookie list with 1 entries");
ok($firebug_ref->{log}->{entries}->[0]->{request}->{cookies}->[0]->{name} eq 'PREF', "OUTPUT: HttpWatch's archive first entry request has a name of 'PREF'");
ok($firebug_ref->{log}->{entries}->[0]->{request}->{cookies}->[0]->{value} eq 'ID=31245dd052940995:TM=1333416734:LM=1333416734:S=GVCghq5oz8F4iPqS', "OUTPUT: HttpWatch's archive first entry request has a value of 'ID=31245dd052940995:TM=1333416734:LM=...
ok($firebug_ref->{log}->{entries}->[0]->{request}->{cookies}->[0]->{path} eq '/', "OUTPUT: HttpWatch's archive first entry request has a path of '/'");
ok($firebug_ref->{log}->{entries}->[0]->{request}->{cookies}->[0]->{domain} eq '.google.com', "OUTPUT: HttpWatch's archive first entry request has a domain of '.google.com'");
ok($firebug_ref->{log}->{entries}->[0]->{request}->{cookies}->[0]->{expires} eq '2014-04-03T01:32:16.000Z', "OUTPUT: HttpWatch's archive first entry request has a expires of '2014-04-03T01:32:16.000Z'");
ok($firebug_ref->{log}->{entries}->[0]->{request}->{cookies}->[0]->{httpOnly} eq '0', "OUTPUT: HttpWatch's archive first entry request has a httpOnly set to false");
ok($firebug_ref->{log}->{entries}->[0]->{request}->{cookies}->[0]->{secure} eq '0', "OUTPUT: HttpWatch's archive first entry request has a httpOnly set to false");
ok($firebug_ref->{log}->{entries}->[0]->{response}->{cookies}->[0]->{name} eq 'GAPS', "OUTPUT: HttpWatch's archive first entry response has a name of 'GAPS'");
ok($firebug_ref->{log}->{entries}->[0]->{response}->{cookies}->[0]->{value} eq '1:UXm7kjQDHHUZVCIzJEuqpbo7xhUpSw:pesWZreBW2aeymnv', "OUTPUT: HttpWatch's archive first entry response has a value of '1:UXm7kjQDHHUZVCIzJEuqpbo7xhUpSw:pesWZreBW2aeymnv'")...
ok($firebug_ref->{log}->{entries}->[0]->{response}->{cookies}->[0]->{path} eq '/', "OUTPUT: HttpWatch's archive first entry response has a path of '/'");
ok($firebug_ref->{log}->{entries}->[0]->{response}->{cookies}->[0]->{domain} eq 'accounts.google.com', "OUTPUT: HttpWatch's archive first entry response has a domain of 'accounts.google.com'");
ok($firebug_ref->{log}->{entries}->[0]->{response}->{cookies}->[0]->{expires} eq '2014-04-03T22:13:46.000Z', "OUTPUT: HttpWatch's archive first entry response has a expires of '2014-04-03T22:13:46.000Z'");
ok($firebug_ref->{log}->{entries}->[0]->{response}->{cookies}->[0]->{httpOnly}, "OUTPUT: HttpWatch's archive first entry response has httpOnly set to true");
ok($firebug_ref->{log}->{entries}->[0]->{response}->{cookies}->[0]->{secure}, "OUTPUT: HttpWatch's archive first entry response has secure set to true");
( run in 1.626 second using v1.01-cache-2.11-cpan-ceb78f64989 )