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

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

Issue 15520002: Moved DOMActionType information from extras into a real field (ActivityLog) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added prefix Created 7 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 | « no previous file | chrome/browser/extensions/activity_log/activity_log.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <string> 5 #include <string>
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "base/test/simple_test_clock.h" 11 #include "base/test/simple_test_clock.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "chrome/browser/extensions/activity_log/activity_database.h" 13 #include "chrome/browser/extensions/activity_log/activity_database.h"
14 #include "chrome/browser/extensions/activity_log/api_actions.h" 14 #include "chrome/browser/extensions/activity_log/api_actions.h"
15 #include "chrome/browser/extensions/activity_log/blocked_actions.h" 15 #include "chrome/browser/extensions/activity_log/blocked_actions.h"
16 #include "chrome/browser/extensions/activity_log/dom_actions.h" 16 #include "chrome/browser/extensions/activity_log/dom_actions.h"
17 #include "chrome/browser/extensions/extension_service.h" 17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/test_extension_system.h" 18 #include "chrome/browser/extensions/test_extension_system.h"
19 #include "chrome/common/chrome_constants.h" 19 #include "chrome/common/chrome_constants.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/extensions/dom_action_types.h"
21 #include "chrome/test/base/chrome_render_view_host_test_harness.h" 22 #include "chrome/test/base/chrome_render_view_host_test_harness.h"
22 #include "chrome/test/base/testing_profile.h" 23 #include "chrome/test/base/testing_profile.h"
23 #include "content/public/browser/web_contents.h" 24 #include "content/public/browser/web_contents.h"
24 #include "content/public/test/test_browser_thread.h" 25 #include "content/public/test/test_browser_thread.h"
25 #include "sql/statement.h" 26 #include "sql/statement.h"
26 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
27 28
28 #if defined(OS_CHROMEOS) 29 #if defined(OS_CHROMEOS)
29 #include "chrome/browser/chromeos/cros/cros_library.h" 30 #include "chrome/browser/chromeos/cros/cros_library.h"
30 #include "chrome/browser/chromeos/login/mock_user_manager.h" 31 #include "chrome/browser/chromeos/login/mock_user_manager.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 scoped_refptr<APIAction> api_action = new APIAction( 194 scoped_refptr<APIAction> api_action = new APIAction(
194 "punky", 195 "punky",
195 mock_clock.Now() - base::TimeDelta::FromMinutes(40), 196 mock_clock.Now() - base::TimeDelta::FromMinutes(40),
196 APIAction::CALL, 197 APIAction::CALL,
197 "brewster", 198 "brewster",
198 "woof", 199 "woof",
199 "extra"); 200 "extra");
200 scoped_refptr<DOMAction> dom_action = new DOMAction( 201 scoped_refptr<DOMAction> dom_action = new DOMAction(
201 "punky", 202 "punky",
202 mock_clock.Now(), 203 mock_clock.Now(),
203 DOMAction::MODIFIED, 204 DomActionType::MODIFIED,
204 GURL("http://www.google.com"), 205 GURL("http://www.google.com"),
205 string16(), 206 string16(),
206 "lets", 207 "lets",
207 "vamoose", 208 "vamoose",
208 "extra"); 209 "extra");
209 scoped_refptr<DOMAction> extra_dom_action = new DOMAction( 210 scoped_refptr<DOMAction> extra_dom_action = new DOMAction(
210 "scoobydoo", 211 "scoobydoo",
211 mock_clock.Now(), 212 mock_clock.Now(),
212 DOMAction::MODIFIED, 213 DomActionType::MODIFIED,
213 GURL("http://www.google.com"), 214 GURL("http://www.google.com"),
214 string16(), 215 string16(),
215 "lets", 216 "lets",
216 "vamoose", 217 "vamoose",
217 "extra"); 218 "extra");
218 activity_db->RecordAction(api_action); 219 activity_db->RecordAction(api_action);
219 activity_db->RecordAction(dom_action); 220 activity_db->RecordAction(dom_action);
220 activity_db->RecordAction(extra_dom_action); 221 activity_db->RecordAction(extra_dom_action);
221 222
222 // Read them back 223 // Read them back
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 "punky", 255 "punky",
255 mock_clock.Now() - base::TimeDelta::FromDays(3) 256 mock_clock.Now() - base::TimeDelta::FromDays(3)
256 - base::TimeDelta::FromMinutes(40), 257 - base::TimeDelta::FromMinutes(40),
257 APIAction::CALL, 258 APIAction::CALL,
258 "brewster", 259 "brewster",
259 "woof", 260 "woof",
260 "extra"); 261 "extra");
261 scoped_refptr<DOMAction> dom_action = new DOMAction( 262 scoped_refptr<DOMAction> dom_action = new DOMAction(
262 "punky", 263 "punky",
263 mock_clock.Now() - base::TimeDelta::FromDays(3), 264 mock_clock.Now() - base::TimeDelta::FromDays(3),
264 DOMAction::MODIFIED, 265 DomActionType::MODIFIED,
265 GURL("http://www.google.com"), 266 GURL("http://www.google.com"),
266 string16(), 267 string16(),
267 "lets", 268 "lets",
268 "vamoose", 269 "vamoose",
269 "extra"); 270 "extra");
270 scoped_refptr<DOMAction> toonew_dom_action = new DOMAction( 271 scoped_refptr<DOMAction> toonew_dom_action = new DOMAction(
271 "punky", 272 "punky",
272 mock_clock.Now(), 273 mock_clock.Now(),
273 DOMAction::MODIFIED, 274 DomActionType::MODIFIED,
274 GURL("http://www.google.com"), 275 GURL("http://www.google.com"),
275 string16(), 276 string16(),
276 "too new", 277 "too new",
277 "vamoose", 278 "vamoose",
278 "extra"); 279 "extra");
279 scoped_refptr<DOMAction> tooold_dom_action = new DOMAction( 280 scoped_refptr<DOMAction> tooold_dom_action = new DOMAction(
280 "punky", 281 "punky",
281 mock_clock.Now() - base::TimeDelta::FromDays(7), 282 mock_clock.Now() - base::TimeDelta::FromDays(7),
282 DOMAction::MODIFIED, 283 DomActionType::MODIFIED,
283 GURL("http://www.google.com"), 284 GURL("http://www.google.com"),
284 string16(), 285 string16(),
285 "too old", 286 "too old",
286 "vamoose", 287 "vamoose",
287 "extra"); 288 "extra");
288 activity_db->RecordAction(api_action); 289 activity_db->RecordAction(api_action);
289 activity_db->RecordAction(dom_action); 290 activity_db->RecordAction(dom_action);
290 activity_db->RecordAction(toonew_dom_action); 291 activity_db->RecordAction(toonew_dom_action);
291 activity_db->RecordAction(tooold_dom_action); 292 activity_db->RecordAction(tooold_dom_action);
292 293
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 APIAction::CALL, 396 APIAction::CALL,
396 "brewster", 397 "brewster",
397 "woooof", 398 "woooof",
398 "extra"); 399 "extra");
399 activity_db->RecordAction(action); 400 activity_db->RecordAction(action);
400 activity_db->Close(); 401 activity_db->Close();
401 } 402 }
402 403
403 } // namespace 404 } // namespace
404 405
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/activity_log/activity_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698