| OLD | NEW |
| 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 "chrome/browser/extensions/activity_log/counting_policy.h" | 5 #include "chrome/browser/extensions/activity_log/counting_policy.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/cancelable_callback.h" | 13 #include "base/cancelable_callback.h" |
| 14 #include "base/command_line.h" | 14 #include "base/command_line.h" |
| 15 #include "base/location.h" | 15 #include "base/location.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/run_loop.h" | 17 #include "base/run_loop.h" |
| 18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
| 19 #include "base/strings/string_split.h" | 19 #include "base/strings/string_split.h" |
| 20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
| 21 #include "base/synchronization/waitable_event.h" | 21 #include "base/synchronization/waitable_event.h" |
| 22 #include "base/test/simple_test_clock.h" | 22 #include "base/test/simple_test_clock.h" |
| 23 #include "base/test/test_timeouts.h" | 23 #include "base/test/test_timeouts.h" |
| 24 #include "base/threading/thread_task_runner_handle.h" | 24 #include "base/threading/thread_task_runner_handle.h" |
| 25 #include "base/values.h" |
| 25 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 26 #include "chrome/browser/extensions/activity_log/activity_log.h" | 27 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 27 #include "chrome/browser/extensions/extension_service.h" | 28 #include "chrome/browser/extensions/extension_service.h" |
| 28 #include "chrome/browser/extensions/test_extension_system.h" | 29 #include "chrome/browser/extensions/test_extension_system.h" |
| 29 #include "chrome/common/chrome_constants.h" | 30 #include "chrome/common/chrome_constants.h" |
| 30 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
| 31 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 32 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 32 #include "chrome/test/base/testing_profile.h" | 33 #include "chrome/test/base/testing_profile.h" |
| 33 #include "content/public/test/test_browser_thread_bundle.h" | 34 #include "content/public/test/test_browser_thread_bundle.h" |
| 34 #include "extensions/common/extension_builder.h" | 35 #include "extensions/common/extension_builder.h" |
| (...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 ExtensionBuilder() | 427 ExtensionBuilder() |
| 427 .SetManifest(DictionaryBuilder() | 428 .SetManifest(DictionaryBuilder() |
| 428 .Set("name", "Test extension") | 429 .Set("name", "Test extension") |
| 429 .Set("version", "1.0.0") | 430 .Set("version", "1.0.0") |
| 430 .Set("manifest_version", 2) | 431 .Set("manifest_version", 2) |
| 431 .Build()) | 432 .Build()) |
| 432 .Build(); | 433 .Build(); |
| 433 extension_service_->AddExtension(extension.get()); | 434 extension_service_->AddExtension(extension.get()); |
| 434 | 435 |
| 435 std::unique_ptr<base::ListValue> args(new base::ListValue()); | 436 std::unique_ptr<base::ListValue> args(new base::ListValue()); |
| 436 args->Set(0, new base::Value("hello")); | 437 args->Set(0, base::MakeUnique<base::Value>("hello")); |
| 437 args->Set(1, new base::Value("world")); | 438 args->Set(1, base::MakeUnique<base::Value>("world")); |
| 438 scoped_refptr<Action> action = new Action(extension->id(), | 439 scoped_refptr<Action> action = new Action(extension->id(), |
| 439 base::Time::Now(), | 440 base::Time::Now(), |
| 440 Action::ACTION_API_CALL, | 441 Action::ACTION_API_CALL, |
| 441 "extension.connect"); | 442 "extension.connect"); |
| 442 action->set_args(std::move(args)); | 443 action->set_args(std::move(args)); |
| 443 | 444 |
| 444 policy->ProcessAction(action); | 445 policy->ProcessAction(action); |
| 445 CheckReadData(policy, | 446 CheckReadData(policy, |
| 446 extension->id(), | 447 extension->id(), |
| 447 0, | 448 0, |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 | 1280 |
| 1280 action_ids.push_back(2); | 1281 action_ids.push_back(2); |
| 1281 CheckRemoveActions( | 1282 CheckRemoveActions( |
| 1282 policy, action_ids, base::Bind(&CountingPolicyTest::Action2Deleted)); | 1283 policy, action_ids, base::Bind(&CountingPolicyTest::Action2Deleted)); |
| 1283 action_ids.clear(); | 1284 action_ids.clear(); |
| 1284 | 1285 |
| 1285 policy->Close(); | 1286 policy->Close(); |
| 1286 } | 1287 } |
| 1287 | 1288 |
| 1288 } // namespace extensions | 1289 } // namespace extensions |
| OLD | NEW |