root/HTTP-MobileAgent/trunk/t/02_docomo.t

Revision 890 (checked in by miyagawa, 17 years ago)

version 0.10

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 use strict;
2 use Test::More tests => 787;
3
4 BEGIN { use_ok 'HTTP::MobileAgent' }
5
6 my @Tests = (
7     # ua, version, html_version, model, cache_size, is_foma, vendor, series, options
8     [ "DoCoMo/1.0/D501i", '1.0', '1.0', 'D501i', 5, undef, 'D', '501i' ],
9     [ "DoCoMo/1.0/D502i", '1.0', '2.0', 'D502i', 5, undef, 'D', '502i' ],
10     [ "DoCoMo/1.0/D502i/c10", '1.0', '2.0', 'D502i', 10, undef, 'D', '502i' ],
11     [ "DoCoMo/1.0/D210i/c10", '1.0', '3.0', 'D210i', 10, undef, 'D', '210i' ],
12     [ "DoCoMo/1.0/SO503i/c10", '1.0', '3.0', 'SO503i', 10, undef, 'SO', '503i' ],
13     [ "DoCoMo/1.0/D211i/c10", '1.0', '3.0', 'D211i', 10, undef, 'D', '211i' ],
14     [ "DoCoMo/1.0/SH251i/c10", '1.0', '3.0', 'SH251i', 10, undef, 'SH', '251i' ],
15     [ "DoCoMo/1.0/R692i/c10", '1.0', '3.0', 'R692i', 10, undef, 'R', '692i' ],
16     [ "DoCoMo/2.0 P2101V(c100)", '2.0', '3.0', 'P2101V', 100, 1, 'P', 'FOMA' ],
17     [ "DoCoMo/2.0 N2001(c10)", '2.0', '3.0', 'N2001', 10, 1, 'N', 'FOMA' ],
18     [ "DoCoMo/2.0 N2002(c100)", '2.0', '3.0', 'N2002', 100, 1, 'N', 'FOMA' ],
19     [ "DoCoMo/2.0 D2101V(c100)", '2.0', '3.0', 'D2101V', 100, 1, 'D', 'FOMA' ],
20     [ "DoCoMo/2.0 P2002(c100)", '2.0', '3.0', 'P2002', 100, 1, 'P', 'FOMA' ],
21     [ "DoCoMo/2.0 MST_v_SH2101V(c100)", '2.0', '3.0', 'SH2101V', 100, 1, 'SH', 'FOMA' ],
22     [ "DoCoMo/2.0 T2101V(c100)", '2.0', '3.0', 'T2101V', 100, 1, 'T', 'FOMA' ],
23     [ "DoCoMo/1.0/D504i/c10", '1.0', '4.0', 'D504i', 10, undef, 'D', '504i' ],
24     [ "DoCoMo/1.0/D504i/c30/TD", '1.0', '4.0', 'D504i', 30, undef, 'D', '504i', { status => 'TD' } ],
25     [ "DoCoMo/1.0/D504i/c10/TJ", '1.0', '4.0', 'D504i', 10, undef, 'D', '504i', { status => 'TJ' } ],
26     [ "DoCoMo/1.0/F504i/c10/TB", '1.0', '4.0', 'F504i', 10, undef, 'F', '504i', { status => 'TB' } ],
27     [ "DoCoMo/1.0/D251i/c10", '1.0', '4.0', 'D251i', 10, undef, 'D', '251i' ],
28     [ "DoCoMo/1.0/F251i/c10/TB", '1.0', '4.0', 'F251i', 10, undef, 'F', '251i', { status => 'TB' } ],
29     [ "DoCoMo/1.0/F671iS/c10/TB", '1.0', '4.0', 'F671iS', 10, undef, 'F', '671i', { status => 'TB' } ],
30     [ "DoCoMo/1.0/P503i/c10/serNMABH200331", '1.0', '3.0', 'P503i', 10, undef, 'P', '503i', { serial_number => 'NMABH200331' } ],
31     [ "DoCoMo/2.0 N2001(c10;ser0123456789abcde;icc01234567890123456789)",
32       '2.0', '3.0', 'N2001', 10, 1, 'N', 'FOMA', { serial_number => '0123456789abcde', card_id => '01234567890123456789' } ],
33     [ "DoCoMo/1.0/eggy/c300/s32/kPHS-K", '1.0', '3.2', 'eggy', 300, undef, undef, undef, { bandwidth => 32 } ],
34     [ "DoCoMo/1.0/P751v/c100/s64/kPHS-K", '1.0', '3.2', 'P751v', 100, undef, 'P', undef, { bandwidth => 64 } ],
35     [ "DoCoMo/1.0/P209is (Google CHTML Proxy/1.0)", '1.0', '2.0', 'P209is', 5, undef, 'P', '209i', { comment => 'Google CHTML Proxy/1.0' } ],
36     [ "DoCoMo/1.0/F212i/c10/TB", '1.0', '4.0', 'F212i', 10, undef, 'F', '212i' ],
37     [ "DoCoMo/2.0 N2051(c100;TB)", '2.0', '4.0', 'N2051', 100, 1, 'N', 'FOMA' ],
38     [ "DoCoMo/1.0/D505i/c20/TC/W20H10", '1.0', '5.0', 'D505i', 20, undef, 'D', '505i', { status => 'TC' } ],
39 );
40
41 for (@Tests) {
42     my($ua, @data) = @$_;
43     my $agent = HTTP::MobileAgent->new($ua);
44     isa_ok $agent, 'HTTP::MobileAgent';
45     isa_ok $agent, 'HTTP::MobileAgent::DoCoMo';
46     ok $agent->is_docomo && ! $agent->is_j_phone && ! $agent->is_ezweb;
47     is $agent->name, 'DoCoMo';
48     is $agent->user_agent, $ua,         "ua is $ua";
49     is $agent->version, $data[0],       "version is $data[0]";
50     is $agent->html_version, $data[1],  "HTML version is $data[1]";
51     is $agent->model, $data[2],         "model is $data[2]";
52     is $agent->cache_size, $data[3],    "cache size is $data[3]";
53     is $agent->is_foma, $data[4],       "is_foma";
54     is $agent->vendor, $data[5],        "vendor";
55     is $agent->series, $data[6],        "cache size";
56     if ($data[7]) {
57         is $agent->$_(), $data[7]->{$_},"testing $_" for keys %{$data[7]};
58     }
59 }
60
61
62 while (<DATA>) {
63     next if /^#/;
64     chomp;
65     local $ENV{HTTP_USER_AGENT} = $_;
66     my $agent = HTTP::MobileAgent->new;
67     isa_ok $agent, 'HTTP::MobileAgent', "$_";
68     is $agent->name, 'DoCoMo';
69     ok $agent->is_docomo && ! $agent->is_j_phone && ! $agent->is_ezweb;
70 }
71
72 __END__
73 DoCoMo/1.0/633S/c20
74 DoCoMo/1.0/641P/c10
75 DoCoMo/1.0/641S/c10
76 DoCoMo/1.0/642S/c20
77 DoCoMo/1.0/Agent
78 DoCoMo/1.0/D209i
79 DoCoMo/1.0/D209i/c10
80 DoCoMo/1.0/D210i/c10
81 DoCoMo/1.0/D211i/c10
82 DoCoMo/1.0/D251i/c10
83 DoCoMo/1.0/D501i
84 DoCoMo/1.0/D501i/c5
85 DoCoMo/1.0/D502i
86 DoCoMo/1.0/D502i/c10
87 DoCoMo/1.0/D503i
88 DoCoMo/1.0/D503i/c10
89 DoCoMo/1.0/D503i/c5
90 DoCoMo/1.0/D503iS/c10
91 DoCoMo/1.0/D503iS/c5
92 DoCoMo/1.0/D504i/c10
93 DoCoMo/1.0/ER209i
94 DoCoMo/1.0/ER209i/c15
95 DoCoMo/1.0/F209i
96 DoCoMo/1.0/F209i/c10
97 DoCoMo/1.0/F210i/c10
98 DoCoMo/1.0/F211i/c10
99 DoCoMo/1.0/F251i/c10/TB
100 DoCoMo/1.0/F501i
101 DoCoMo/1.0/F502i
102 DoCoMo/1.0/F502i/c10
103 DoCoMo/1.0/F502it
104 DoCoMo/1.0/F502it/c10
105 DoCoMo/1.0/F503i
106 DoCoMo/1.0/F503i/c10
107 DoCoMo/1.0/F503i/c32
108 DoCoMo/1.0/F503iS
109 DoCoMo/1.0/F503iS/c10
110 DoCoMo/1.0/F504i/c10/TB
111 DoCoMo/1.0/F504i/c10/TJ
112 DoCoMo/1.0/F671i/c10
113 DoCoMo/1.0/GigaCode (http://gigacode.net/)
114 DoCoMo/1.0/KO209i
115 DoCoMo/1.0/KO210i
116 DoCoMo/1.0/KO210i/c10
117 DoCoMo/1.0/N209i
118 DoCoMo/1.0/N209i/c08
119 DoCoMo/1.0/N210i
120 DoCoMo/1.0/N210i/c10
121 DoCoMo/1.0/N211i/c10
122 DoCoMo/1.0/N501i
123 DoCoMo/1.0/N502i
124 DoCoMo/1.0/N502i/c08
125 DoCoMo/1.0/N502it
126 DoCoMo/1.0/N502it/c10
127 DoCoMo/1.0/N503i
128 DoCoMo/1.0/N503i/c10
129 DoCoMo/1.0/N503i/c30
130 DoCoMo/1.0/N503i/c5
131 DoCoMo/1.0/N503i/c5/serNNEBJ608187
132 DoCoMo/1.0/N503iS
133 DoCoMo/1.0/N503iS/c10
134 DoCoMo/1.0/N503iS/c5
135 DoCoMo/1.0/N504i/c10
136 DoCoMo/1.0/N504i/c10/TB
137 DoCoMo/1.0/N504i/c10/TJ
138 DoCoMo/1.0/N504i/c10/TJ/c0
139 DoCoMo/1.0/N821i
140 DoCoMo/1.0/N821i/c08
141 DoCoMo/1.0/NM502i
142 DoCoMo/1.0/NM502i/c10
143 DoCoMo/1.0/P209i
144 DoCoMo/1.0/P209i/c10
145 DoCoMo/1.0/P209is
146 DoCoMo/1.0/P209is (Google CHTML Proxy/1.0)
147 DoCoMo/1.0/P209is/c10
148 DoCoMo/1.0/P210i
149 DoCoMo/1.0/P210i/c10
150 DoCoMo/1.0/P211i/c10
151 DoCoMo/1.0/P501i
152 DoCoMo/1.0/P502i
153 DoCoMo/1.0/P502i/c10
154 DoCoMo/1.0/P502i/c10 (Google CHTML Proxy/1.0)
155 DoCoMo/1.0/P502i_mEB-PD555
156 DoCoMo/1.0/P503i
157 DoCoMo/1.0/P503i/c10
158 DoCoMo/1.0/P503i/c10/
159 DoCoMo/1.0/P503iS
160 DoCoMo/1.0/P503iS/c10
161 DoCoMo/1.0/P503iS/c10/serNMAUA482012
162 DoCoMo/1.0/P504i/c10
163 DoCoMo/1.0/P504i/c10/TB
164 DoCoMo/1.0/P751v/c100/s64/kPHS-K
165 DoCoMo/1.0/P821i
166 DoCoMo/1.0/P821i/c08
167 DoCoMo/1.0/PacketMeter/c10
168 DoCoMo/1.0/R209i
169 DoCoMo/1.0/R211i/c10
170 DoCoMo/1.0/R691i
171 DoCoMo/1.0/SH251i/c10
172 DoCoMo/1.0/SH712m/c10
173 DoCoMo/1.0/SH821i
174 DoCoMo/1.0/SH821i/c10
175 DoCoMo/1.0/SO210i/c10
176 DoCoMo/1.0/SO211i/c10
177 DoCoMo/1.0/SO502i
178 DoCoMo/1.0/SO502iWM/c10
179 DoCoMo/1.0/SO503i
180 DoCoMo/1.0/SO503i/c10
181 DoCoMo/1.0/SO503i/c10/serNSOBD506895
182 DoCoMo/1.0/SO503i/c10/serNSOBD597705
183 DoCoMo/1.0/SO503iS/c10
184 DoCoMo/1.0/SO504i/c10
185 DoCoMo/1.0/SO504i/c10/TB
186 DoCoMo/1.0/TEST/c10
187 DoCoMo/1.0/TF502i
188 DoCoMo/1.0/X503i/c10
189 DoCoMo/1.0/eggy/c300/s32/kPHS-K
190 DoCoMo/1.0/eggy/c300/s64/kPHS-K
191 DoCoMo/1.0/ex_idisplay/c10
192 DoCoMo/1.0/ex_ps_test00/c10
193 DoCoMo/1.0/iYappo
194 DoCoMo/1.0/p503is/c10
195 DoCoMo/1.0/test
196 DoCoMo/1.0/test/c10
197 DoCoMo/1.0/test/c10/TB
198 DoCoMo/1.1/P711m/c10
199 DoCoMo/2.0 D2101V(c100)
200 DoCoMo/2.0 MST_v_P2101V(c100)
201 DoCoMo/2.0 N2001(c10)
202 DoCoMo/2.0 N2001(c10;ser350200000307969;icc8981100000200188565F)
203 DoCoMo/2.0 N2002(c100)
204 DoCoMo/2.0 P2002(c100)
205 DoCoMo/2.0 P2101V
206 DoCoMo/2.0 P2101V(c100)
207 DoCoMo/2.0/N502i
208 DoCoMo/2.0/N502it
209 DoCoMo/2.0/N503i
210 DoCoMo/3.0/N503
Note: See TracBrowser for help on using the browser.