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

Side by Side Diff: chrome/browser/extensions/activity_log/activity_actions.cc

Issue 23449016: Update tests to check fields directly. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/browser/extensions/activity_log/activity_actions.h" 5 #include "chrome/browser/extensions/activity_log/activity_actions.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 Action::Action(const std::string& extension_id, 45 Action::Action(const std::string& extension_id,
46 const base::Time& time, 46 const base::Time& time,
47 const ActionType action_type, 47 const ActionType action_type,
48 const std::string& api_name) 48 const std::string& api_name)
49 : extension_id_(extension_id), 49 : extension_id_(extension_id),
50 time_(time), 50 time_(time),
51 action_type_(action_type), 51 action_type_(action_type),
52 api_name_(api_name), 52 api_name_(api_name),
53 page_incognito_(false), 53 page_incognito_(false),
54 arg_incognito_(false) {} 54 arg_incognito_(false),
55 count_(0) {}
55 56
56 Action::~Action() {} 57 Action::~Action() {}
57 58
58 // TODO(mvrable): As an optimization, we might return this directly if the 59 // TODO(mvrable): As an optimization, we might return this directly if the
59 // refcount is one. However, there are likely to be other stray references in 60 // refcount is one. However, there are likely to be other stray references in
60 // many cases that will prevent this optimization. 61 // many cases that will prevent this optimization.
61 scoped_refptr<Action> Action::Clone() const { 62 scoped_refptr<Action> Action::Clone() const {
62 scoped_refptr<Action> clone( 63 scoped_refptr<Action> clone(
63 new Action(extension_id(), time(), action_type(), api_name())); 64 new Action(extension_id(), time(), action_type(), api_name()));
64 if (args()) 65 if (args())
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 if (arg_url_.is_valid()) { 224 if (arg_url_.is_valid()) {
224 if (arg_incognito_) 225 if (arg_incognito_)
225 result += " ARG_URL=(incognito)" + arg_url_.spec(); 226 result += " ARG_URL=(incognito)" + arg_url_.spec();
226 else 227 else
227 result += " ARG_URL=" + arg_url_.spec(); 228 result += " ARG_URL=" + arg_url_.spec();
228 } 229 }
229 if (other_.get()) { 230 if (other_.get()) {
230 result += " OTHER=" + Serialize(other_.get()); 231 result += " OTHER=" + Serialize(other_.get());
231 } 232 }
232 233
234 result += base::StringPrintf(" COUNT=%d", count_);
233 return result; 235 return result;
234 } 236 }
235 237
236 bool ActionComparator::operator()( 238 bool ActionComparator::operator()(
237 const scoped_refptr<Action>& lhs, 239 const scoped_refptr<Action>& lhs,
238 const scoped_refptr<Action>& rhs) const { 240 const scoped_refptr<Action>& rhs) const {
239 if (lhs->time() != rhs->time()) 241 if (lhs->time() != rhs->time())
240 return lhs->time() < rhs->time(); 242 return lhs->time() < rhs->time();
241 else 243 else
242 return ActionComparatorExcludingTime()(lhs, rhs); 244 return ActionComparatorExcludingTime()(lhs, rhs);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 std::string rhs_other = ActivityLogPolicy::Util::Serialize(rhs->other()); 291 std::string rhs_other = ActivityLogPolicy::Util::Serialize(rhs->other());
290 if (lhs_other != rhs_other) 292 if (lhs_other != rhs_other)
291 return lhs_other < rhs_other; 293 return lhs_other < rhs_other;
292 } 294 }
293 295
294 // All fields compare as equal if this point is reached. 296 // All fields compare as equal if this point is reached.
295 return false; 297 return false;
296 } 298 }
297 299
298 } // namespace extensions 300 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698