File Coverage

lib/Test/MobileAgent/Softbank.pm
Criterion Covered Total %
statement 25 25 100.0
branch 8 10 80.0
condition 3 5 60.0
subroutine 5 5 100.0
pod n/a
total 41 45 91.1


line stmt bran cond sub pod time code
1             package Test::MobileAgent::Softbank;
2              
3 4     4   1200 use strict;
  4         8  
  4         159  
4 4     4   20 use warnings;
  4         8  
  4         121  
5 4     4   30 use base 'Test::MobileAgent::Base';
  4         6  
  4         3083  
6              
7             sub _modify_headers {
8 528     528   1452 my ($class, %headers) = @_;
9              
10 528 100       1300 if (exists $headers{_USER_ID}) {
11 6         25 $headers{HTTP_X_JPHONE_UID} = delete $headers{_USER_ID};
12             }
13              
14 528   100     2774 my $serial = delete $headers{_SERIAL_NUMBER} || '';
15              
16 528 100       1144 if ($serial) {
17 6         15 my $ua = $headers{HTTP_USER_AGENT};
18 6         26 my ($main, $extra) = split / /, $ua, 2;
19 6 100 33     57 if ($ua =~ /^(?:Vodafone|SoftBank)/) {
    50          
20 4         21 my ($name, $version, $model, $_maker, $sn) = split '/', $main;
21 4         23 $main = join '/', $name, $version, $model, $_maker, "SN$serial";
22             }
23             elsif ($extra and $ua =~ /^J\-PHONE/) {
24 2         11 my ($name, $version, $model, $sn) = split '/', $main;
25 2         10 $main = join '/', $name, $version, $model, "SN$serial";
26             }
27 6         12 $headers{HTTP_USER_AGENT} = $main;
28 6 50       36 $headers{HTTP_USER_AGENT} .= " $extra" if $extra;
29             }
30              
31 528         2634 return %headers;
32             }
33              
34             # this list is borrowed from HTTP::MobileAgent's t/10_softbank.t
35             # last updated: Fri Jan 14 14:56:46 2011
36 4     4   217 sub _list {q{
37             SoftBank/1.0/910T/TJ001/SNXXXXXXXXX Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
38             SoftBank/1.0/910T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
39             SoftBank/1.0/840P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
40             SoftBank/1.0/941SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
41             SoftBank/1.0/940SC/SCJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
42             SoftBank/1.0/931N/NJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
43             SoftBank/1.0/940SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
44             SoftBank/1.0/832SHs/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
45             #SoftBank/1.0/740SC/SCJ001 Browser/NetFront/3.3
46             SoftBank/1.0/831N/NJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
47             #SoftBank/1.0/830SC/SCJ001 Browser/NetFront/3.3
48             SoftBank/1.0/936SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
49             SoftBank/1.0/832SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
50             SoftBank/1.0/935SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
51             SoftBank/1.0/931P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
52             #SoftBank/1.0/832T/TJ001 Browser/NetFront/3.3
53             SoftBank/1.0/931SC/SCJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
54             SoftBank/1.0/930N/NJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
55             SoftBank/1.0/934SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
56             SoftBank/1.0/933SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
57             SoftBank/1.0/832P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
58             SoftBank/1.0/831SHs/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
59             SoftBank/1.0/831SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
60             SoftBank/1.0/830SHp/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
61             #SoftBank/1.0/731SC/SCJ001 Browser/NetFront/3.3
62             SoftBank/1.0/831P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
63             SoftBank/1.0/930CA/CAJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
64             SoftBank/1.0/830SHe/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
65             SoftBank/1.0/830N/NJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
66             SoftBank/1.0/932SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
67             SoftBank/1.0/831SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
68             SoftBank/1.0/930P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
69             SoftBank/1.0/831T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
70             SoftBank/1.0/830T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
71             SoftBank/1.0/931SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
72             #SoftBank/1.0/930SC/SCJ001 Browser/NetFront/3.4
73             SoftBank/1.0/930SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
74             SoftBank/1.0/830CA/CAJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
75             SoftBank/1.0/830P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
76             SoftBank/1.0/830SHs/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
77             SoftBank/1.0/830SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
78             SoftBank/1.0/824T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
79             SoftBank/1.0/823T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
80             SoftBank/1.0/921P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
81             SoftBank/1.0/824P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
82             SoftBank/1.0/923SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
83             SoftBank/1.0/824SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
84             SoftBank/1.0/821N/NJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
85             SoftBank/1.0/820N/NJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
86             SoftBank/1.0/825SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
87             SoftBank/1.0/823P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
88             SoftBank/1.0/815T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
89             SoftBank/1.0/922SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
90             SoftBank/1.0/921T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
91             SoftBank/1.0/921SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
92             SoftBank/1.0/920T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
93             SoftBank/1.0/920SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
94             SoftBank/1.0/920SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
95             SoftBank/1.0/920SC/SCJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
96             SoftBank/1.0/920P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
97             SoftBank/1.0/913SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
98             SoftBank/1.0/913SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
99             SoftBank/1.0/912T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
100             SoftBank/1.0/912SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
101             SoftBank/1.0/911T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configutation/CLDC-1.1
102             SoftBank/1.0/911SH/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
103             SoftBank/1.0/910SH/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
104             SoftBank/1.0/823SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
105             SoftBank/1.0/822T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
106             SoftBank/1.0/822SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
107             SoftBank/1.0/822P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
108             #SoftBank/1.0/821T/TJ001 Browser/NetFront/3.3
109             SoftBank/1.0/821SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
110             SoftBank/1.0/821SC/SCJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
111             SoftBank/1.0/821P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
112             SoftBank/1.0/820T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
113             SoftBank/1.0/820SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
114             SoftBank/1.0/820SC/SCJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
115             SoftBank/1.0/820P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
116             SoftBank/1.0/816SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
117             SoftBank/1.0/815T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
118             SoftBank/1.0/815SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
119             SoftBank/1.0/814T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
120             SoftBank/1.0/814SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
121             SoftBank/1.0/813T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
122             SoftBank/1.0/813SH/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
123             SoftBank/1.0/813SHe/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
124             SoftBank/1.0/812T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
125             SoftBank/1.0/812SH/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
126             SoftBank/1.0/812SHs/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
127             SoftBank/1.0/812SHs/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
128             SoftBank/1.0/812SH/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
129             SoftBank/1.0/811T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
130             SoftBank/1.0/811SH/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
131             SoftBank/1.0/810T/TJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
132             SoftBank/1.0/810SH/SHJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
133             SoftBank/1.0/810P/PJP10 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
134             SoftBank/1.0/805SC/SCJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
135             SoftBank/1.0/709SC/SCJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
136             #SoftBank/1.0/708SC/SCJ001 Browser/NetFront/3.3
137             SoftBank/1.0/707SC2/SCJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
138             SoftBank/1.0/707SC/SCJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
139             SoftBank/1.0/706SC/SCJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
140             SoftBank/1.0/706P/PJP10 Browser/Teleca-Browser/3.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
141             SoftBank/1.0/706N/NJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
142             SoftBank/1.0/705SC/SCJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
143             SoftBank/1.0/705P/PJP10 Browser/Teleca-Browser/3.1 Profile/MIDP-2.0 Configuration/CLDC-1.1
144             SoftBank/1.0/705NK/NKJ001 Series60/3.0 NokiaN73/X.XX.XX Profile/MIDP-2.0 Configuration/CLDC-1.1
145             SoftBank/1.0/705N/NJ001 Browser/NetFront/3.3 Profile/MIDP-2.0 Configuration/CLDC-1.1
146             SoftBank/1.0/DM004SH/SHJ001 Browser/NetFront/3.5 Profile/MIDP-2.0 Configuration/CLDC-1.1
147             SoftBank/1.0/DM003SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
148             SoftBank/1.0/DM002SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
149             SoftBank/1.0/DM001SH/SHJ001 Browser/NetFront/3.4 Profile/MIDP-2.0 Configuration/CLDC-1.1
150             }}
151              
152             1;
153              
154             __END__