@@ -7,26 +7,26 @@ import { PromiseWrapper } from 'angular2/src/facade/async';
77import { WebDriverExtension , bind , Injector , Options } from 'benchpress/common' ;
88
99export function main ( ) {
10- function createExtension ( ids , caps ) {
10+ function createExtension ( ids , userAgent ) {
1111 return new Injector ( [
1212 ListWrapper . map ( ids , ( id ) => bind ( id ) . toValue ( new MockExtension ( id ) ) ) ,
13- bind ( Options . CAPABILITIES ) . toValue ( caps ) ,
13+ bind ( Options . USER_AGENT ) . toValue ( userAgent ) ,
1414 WebDriverExtension . bindTo ( ids )
1515 ] ) . asyncGet ( WebDriverExtension ) ;
1616 }
1717
1818 describe ( 'WebDriverExtension.bindTo' , ( ) => {
1919
20- it ( 'should bind the extension that matches the capabilities ' , ( done ) => {
21- createExtension ( [ 'm1' , 'm2' , 'm3' ] , { 'browser' : ' m2'} ) . then ( ( m ) => {
20+ it ( 'should bind the extension that matches the userAgent ' , ( done ) => {
21+ createExtension ( [ 'm1' , 'm2' , 'm3' ] , ' m2') . then ( ( m ) => {
2222 expect ( m . id ) . toEqual ( 'm2' ) ;
2323 done ( ) ;
2424 } ) ;
2525 } ) ;
2626
2727 it ( 'should throw if there is no match' , ( done ) => {
2828 PromiseWrapper . catchError (
29- createExtension ( [ 'm1' ] , { 'browser' : ' m2'} ) ,
29+ createExtension ( [ 'm1' ] , ' m2') ,
3030 ( err ) => {
3131 expect ( isPresent ( err ) ) . toBe ( true ) ;
3232 done ( ) ;
@@ -45,7 +45,7 @@ class MockExtension extends WebDriverExtension {
4545 this . id = id ;
4646 }
4747
48- supports ( capabilities : StringMap ) :boolean {
49- return StringWrapper . equals ( capabilities [ 'browser' ] , this . id ) ;
48+ supports ( userAgent : string ) :boolean {
49+ return StringWrapper . equals ( userAgent , this . id ) ;
5050 }
5151}
0 commit comments