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

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

Issue 23567022: [Activity log] Generalize the whitelist for keeping arguments (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
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
« no previous file with comments | « chrome/browser/extensions/activity_log/counting_policy.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/cancelable_callback.h" 5 #include "base/cancelable_callback.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 Action::ACTION_API_CALL, "extension.connect", 184 Action::ACTION_API_CALL, "extension.connect",
185 "[\"hello\",\"world\"]", "", "", "", 1); 185 "[\"hello\",\"world\"]", "", "", "", 1);
186 } 186 }
187 187
188 static void Arguments_GetTodaysActions( 188 static void Arguments_GetTodaysActions(
189 scoped_ptr<Action::ActionVector> actions) { 189 scoped_ptr<Action::ActionVector> actions) {
190 ASSERT_EQ(3, static_cast<int>(actions->size())); 190 ASSERT_EQ(3, static_cast<int>(actions->size()));
191 CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "brewster", 191 CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "brewster",
192 "", "", "", "", 2); 192 "", "", "", "", 2);
193 CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets", 193 CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets",
194 "[\"vamoose\"]", "http://www.google.com/", "", "", 1); 194 "", "http://www.google.com/", "", "", 1);
195 CheckAction(*actions->at(2), "punky", Action::ACTION_API_CALL, 195 CheckAction(*actions->at(2), "punky", Action::ACTION_API_CALL,
196 "extension.sendMessage", "[\"not\",\"stripped\"]", "", "", "", 196 "extension.sendMessage", "[\"not\",\"stripped\"]", "", "", "",
197 1); 197 1);
198 } 198 }
199 199
200 static void Arguments_GetOlderActions( 200 static void Arguments_GetOlderActions(
201 scoped_ptr<Action::ActionVector> actions) { 201 scoped_ptr<Action::ActionVector> actions) {
202 ASSERT_EQ(2, static_cast<int>(actions->size())); 202 ASSERT_EQ(2, static_cast<int>(actions->size()));
203 CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets", 203 CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
204 "[\"vamoose\"]", "http://www.google.com/", "", "", 1); 204 "", "http://www.google.com/", "", "", 1);
205 CheckAction(*actions->at(1), "punky", Action::ACTION_API_CALL, "brewster", 205 CheckAction(*actions->at(1), "punky", Action::ACTION_API_CALL, "brewster",
206 "", "", "", "", 1); 206 "", "", "", "", 1);
207 } 207 }
208 208
209 static void Arguments_CheckMergeCount( 209 static void Arguments_CheckMergeCount(
210 int count, 210 int count,
211 scoped_ptr<Action::ActionVector> actions) { 211 scoped_ptr<Action::ActionVector> actions) {
212 if (count > 0) { 212 if (count > 0) {
213 ASSERT_EQ(1u, actions->size()); 213 ASSERT_EQ(1u, actions->size());
214 CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "brewster", 214 CheckAction(*actions->at(0), "punky", Action::ACTION_API_CALL, "brewster",
(...skipping 13 matching lines...) Expand all
228 "", "", "", "", count); 228 "", "", "", "", count);
229 ASSERT_EQ(time, actions->at(0)->time()); 229 ASSERT_EQ(time, actions->at(0)->time());
230 } else { 230 } else {
231 ASSERT_EQ(0u, actions->size()); 231 ASSERT_EQ(0u, actions->size());
232 } 232 }
233 } 233 }
234 234
235 static void AllURLsRemoved(scoped_ptr<Action::ActionVector> actions) { 235 static void AllURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
236 ASSERT_EQ(2, static_cast<int>(actions->size())); 236 ASSERT_EQ(2, static_cast<int>(actions->size()));
237 CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets", 237 CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
238 "[\"vamoose\"]", "", "", "", 1); 238 "", "", "", "", 1);
239 CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets", 239 CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets",
240 "[\"vamoose\"]", "", "", "", 1); 240 "", "", "", "", 1);
241 } 241 }
242 242
243 static void SomeURLsRemoved(scoped_ptr<Action::ActionVector> actions) { 243 static void SomeURLsRemoved(scoped_ptr<Action::ActionVector> actions) {
244 // These will be in the vector in reverse time order. 244 // These will be in the vector in reverse time order.
245 ASSERT_EQ(5, static_cast<int>(actions->size())); 245 ASSERT_EQ(5, static_cast<int>(actions->size()));
246 CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets", 246 CheckAction(*actions->at(0), "punky", Action::ACTION_DOM_ACCESS, "lets",
247 "[\"vamoose\"]", "http://www.google.com/", "Google", 247 "", "http://www.google.com/", "Google",
248 "http://www.args-url.com/", 1); 248 "http://www.args-url.com/", 1);
249 CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets", 249 CheckAction(*actions->at(1), "punky", Action::ACTION_DOM_ACCESS, "lets",
250 "[\"vamoose\"]", "http://www.google.com/", "Google", "", 1); 250 "", "http://www.google.com/", "Google", "", 1);
251 CheckAction(*actions->at(2), "punky", Action::ACTION_DOM_ACCESS, "lets", 251 CheckAction(*actions->at(2), "punky", Action::ACTION_DOM_ACCESS, "lets",
252 "[\"vamoose\"]", "", "", "", 1); 252 "", "", "", "", 1);
253 CheckAction(*actions->at(3), "punky", Action::ACTION_DOM_ACCESS, "lets", 253 CheckAction(*actions->at(3), "punky", Action::ACTION_DOM_ACCESS, "lets",
254 "[\"vamoose\"]", "", "", "http://www.google.com/", 1); 254 "", "", "", "http://www.google.com/", 1);
255 CheckAction(*actions->at(4), "punky", Action::ACTION_DOM_ACCESS, "lets", 255 CheckAction(*actions->at(4), "punky", Action::ACTION_DOM_ACCESS, "lets",
256 "[\"vamoose\"]", "", "", "", 1); 256 "", "", "", "", 1);
257 } 257 }
258 258
259 static void CheckDuplicates(scoped_ptr<Action::ActionVector> actions) { 259 static void CheckDuplicates(scoped_ptr<Action::ActionVector> actions) {
260 ASSERT_EQ(2u, actions->size()); 260 ASSERT_EQ(2u, actions->size());
261 int total_count = 0; 261 int total_count = 0;
262 for (size_t i = 0; i < actions->size(); i++) { 262 for (size_t i = 0; i < actions->size(); i++) {
263 total_count += actions->at(i)->count(); 263 total_count += actions->at(i)->count();
264 } 264 }
265 ASSERT_EQ(3, total_count); 265 ASSERT_EQ(3, total_count);
266 } 266 }
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 1034
1035 CheckReadData( 1035 CheckReadData(
1036 policy, 1036 policy,
1037 "punky", 1037 "punky",
1038 0, 1038 0,
1039 base::Bind(&CountingPolicyTest::CheckDuplicates)); 1039 base::Bind(&CountingPolicyTest::CheckDuplicates));
1040 policy->Close(); 1040 policy->Close();
1041 } 1041 }
1042 1042
1043 } // namespace extensions 1043 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/activity_log/counting_policy.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698