Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(333)

Side by Side Diff: chrome/test/webdriver/cookie.cc

Issue 6901084: Use new APIs in base/values.h: Value::GetAsNumber and DictionaryValue::GetNumber. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase, 2010->2011 Created 9 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/json_schema_validator.cc ('k') | content/browser/host_zoom_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/test/webdriver/cookie.h" 5 #include "chrome/test/webdriver/cookie.h"
6 6
7 #include <time.h> 7 #include <time.h>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 } 65 }
66 if (!dict.GetBoolean("secure", &secure_)) { 66 if (!dict.GetBoolean("secure", &secure_)) {
67 secure_ = false; 67 secure_ = false;
68 } 68 }
69 69
70 if (dict.HasKey("expiry")) { 70 if (dict.HasKey("expiry")) {
71 // The expiration time need only be a number with seconds since UTC epcoh; 71 // The expiration time need only be a number with seconds since UTC epcoh;
72 // it could be either a floating point or integer number. 72 // it could be either a floating point or integer number.
73 double expiry; 73 double expiry;
74 if (!dict.GetDouble("expiry", &expiry)) { 74 if (!dict.GetDouble("expiry", &expiry)) {
75 int tmp; 75 return; // Expiry is not a number, so the cookie is invalid.
76 if (!dict.GetInteger("expiry", &tmp))
77 return; // Expiry is not a number, so the cookie is invalid.
78 expiry = static_cast<double>(tmp);
79 } 76 }
80 77
81 expiration_ = base::Time::FromDoubleT(expiry); 78 expiration_ = base::Time::FromDoubleT(expiry);
82 } 79 }
83 80
84 valid_ = true; 81 valid_ = true;
85 } 82 }
86 83
87 Cookie::~Cookie() {} 84 Cookie::~Cookie() {}
88 85
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 cookie += " secure;"; 154 cookie += " secure;";
158 } 155 }
159 if (http_) { 156 if (http_) {
160 cookie += " http_only;"; 157 cookie += " http_only;";
161 } 158 }
162 159
163 return cookie; 160 return cookie;
164 } 161 }
165 162
166 } // namespace webdriver 163 } // namespace webdriver
OLDNEW
« no previous file with comments | « chrome/common/json_schema_validator.cc ('k') | content/browser/host_zoom_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698