Show
Ignore:
Timestamp:
01/07/08 16:42:01 (6 years ago)
Author:
tokuhirom
Message:

HTTP-MobileAgent?: fixed HTTP::MobileAgent::DoCoMo?->xhtml_compliant bug.

before this revision, this method returns invalid value with few very old(2002) models.

tangible models: N2001 N2002 P2002 D2101V P2101V SH2101V T2101V

Location:
lang/perl/HTTP-MobileAgent/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/HTTP-MobileAgent/trunk/lib/HTTP/MobileAgent/DoCoMo.pm

    r4159 r4172  
    5555        $self->_parse_main($main); 
    5656    } 
    57     $self->{xhtml_compliant} = $self->version eq '2.0' ? 1 : 0; 
     57 
     58    $self->{xhtml_compliant} = 
     59      ( $self->is_foma && !( $self->html_version && $self->html_version == 3.0 ) ) 
     60      ? 1 
     61      : 0; 
    5862} 
    5963 
  • lang/perl/HTTP-MobileAgent/trunk/t/02_docomo.t

    r204 r4172  
    11use strict; 
    2 use Test::More tests => 909; 
     2use Test::More tests => 910; 
    33 
    44BEGIN { use_ok 'HTTP::MobileAgent' } 
     
    1414    [ "DoCoMo/1.0/SH251i/c10", '1.0', '3.0', 'SH251i', 10, undef, 'SH', '251i', {}, 0 ], 
    1515    [ "DoCoMo/1.0/R692i/c10", '1.0', '3.0', 'R692i', 10, undef, 'R', '692i', {}, 0 ], 
    16     [ "DoCoMo/2.0 P2101V(c100)", '2.0', '3.0', 'P2101V', 100, 1, 'P', 'FOMA', {}, 1 ], 
    17     [ "DoCoMo/2.0 N2001(c10)", '2.0', '3.0', 'N2001', 10, 1, 'N', 'FOMA', {}, 1 ], 
    18     [ "DoCoMo/2.0 N2002(c100)", '2.0', '3.0', 'N2002', 100, 1, 'N', 'FOMA', {}, 1 ], 
    19     [ "DoCoMo/2.0 D2101V(c100)", '2.0', '3.0', 'D2101V', 100, 1, 'D', 'FOMA', {}, 1 ], 
    20     [ "DoCoMo/2.0 P2002(c100)", '2.0', '3.0', 'P2002', 100, 1, 'P', 'FOMA', {}, 1 ], 
    21     [ "DoCoMo/2.0 MST_v_SH2101V(c100)", '2.0', '3.0', 'SH2101V', 100, 1, 'SH', 'FOMA', {}, 1 ], 
    22     [ "DoCoMo/2.0 T2101V(c100)", '2.0', '3.0', 'T2101V', 100, 1, 'T', 'FOMA', {}, 1 ], 
     16    [ "DoCoMo/2.0 P2101V(c100)", '2.0', '3.0', 'P2101V', 100, 1, 'P', 'FOMA', {}, 0 ], 
     17    [ "DoCoMo/2.0 N2001(c10)", '2.0', '3.0', 'N2001', 10, 1, 'N', 'FOMA', {}, 0 ], 
     18    [ "DoCoMo/2.0 N2002(c100)", '2.0', '3.0', 'N2002', 100, 1, 'N', 'FOMA', {}, 0 ], 
     19    [ "DoCoMo/2.0 D2101V(c100)", '2.0', '3.0', 'D2101V', 100, 1, 'D', 'FOMA', {}, 0 ], 
     20    [ "DoCoMo/2.0 P2002(c100)", '2.0', '3.0', 'P2002', 100, 1, 'P', 'FOMA', {}, 0 ], 
     21    [ "DoCoMo/2.0 MST_v_SH2101V(c100)", '2.0', '3.0', 'SH2101V', 100, 1, 'SH', 'FOMA', {}, 0 ], 
     22    [ "DoCoMo/2.0 T2101V(c100)", '2.0', '3.0', 'T2101V', 100, 1, 'T', 'FOMA', {}, 0 ], 
    2323    [ "DoCoMo/1.0/D504i/c10", '1.0', '4.0', 'D504i', 10, undef, 'D', '504i', {}, 0 ], 
    2424    [ "DoCoMo/1.0/D504i/c30/TD", '1.0', '4.0', 'D504i', 30, undef, 'D', '504i', { status => 'TD' }, 0 ], 
     
    3030    [ "DoCoMo/1.0/P503i/c10/serNMABH200331", '1.0', '3.0', 'P503i', 10, undef, 'P', '503i', { serial_number => 'NMABH200331' }, 0 ], 
    3131    [ "DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789)", 
    32       '2.0', '3.0', 'N2001', 10, 1, 'N', 'FOMA', { serial_number => '0123456789abcde', card_id => '01234567890123456789' }, 1 ], 
     32      '2.0', '3.0', 'N2001', 10, 1, 'N', 'FOMA', { serial_number => '0123456789abcde', card_id => '01234567890123456789' }, 0 ], 
    3333    [ "DoCoMo/1.0/eggy/c300/s32/kPHS-K", '1.0', '3.2', 'eggy', 300, undef, undef, undef, { bandwidth => 32 }, 0 ], 
    3434    [ "DoCoMo/1.0/P751v/c100/s64/kPHS-K", '1.0', '3.2', 'P751v', 100, undef, 'P', undef, { bandwidth => 64 }, 0 ], 
     
    6363    is $agent->carrier_longname, 'DoCoMo' ,  "carrier longname is DoCoMo"; 
    6464 
     65} 
     66 
     67{ 
     68    # SH905i is XHTML Compliant. 
     69    local $ENV{HTTP_USER_AGENT} = 'DoCoMo/2.0 SH905i(c100;TB;W24H12)'; 
     70    my $agent = HTTP::MobileAgent->new; 
     71    is $agent->xhtml_compliant, 1; 
    6572} 
    6673