| 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/fullstream_ui_policy.h" | 5 #include "chrome/browser/extensions/activity_log/fullstream_ui_policy.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/cancelable_callback.h" | 12 #include "base/cancelable_callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.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/stringprintf.h" | 19 #include "base/strings/stringprintf.h" |
| 20 #include "base/synchronization/waitable_event.h" | 20 #include "base/synchronization/waitable_event.h" |
| 21 #include "base/test/simple_test_clock.h" | 21 #include "base/test/simple_test_clock.h" |
| 22 #include "base/test/test_timeouts.h" | 22 #include "base/test/test_timeouts.h" |
| 23 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
| 24 #include "base/values.h" | 24 #include "base/values.h" |
| 25 #include "build/build_config.h" | 25 #include "build/build_config.h" |
| 26 #include "chrome/browser/extensions/activity_log/activity_log.h" | 26 #include "chrome/browser/extensions/activity_log/activity_log.h" |
| 27 #include "chrome/browser/extensions/activity_log/activity_log_task_runner.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" |
| 35 #include "testing/gtest/include/gtest/gtest.h" | 36 #include "testing/gtest/include/gtest/gtest.h" |
| 36 | 37 |
| 37 #if defined(OS_CHROMEOS) | 38 #if defined(OS_CHROMEOS) |
| 38 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 39 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
| 39 #include "chrome/browser/chromeos/settings/cros_settings.h" | 40 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 40 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 41 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 using content::BrowserThread; | |
| 44 | |
| 45 namespace extensions { | 44 namespace extensions { |
| 46 | 45 |
| 47 class FullStreamUIPolicyTest : public testing::Test { | 46 class FullStreamUIPolicyTest : public testing::Test { |
| 48 public: | 47 public: |
| 49 FullStreamUIPolicyTest() | 48 FullStreamUIPolicyTest() |
| 50 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { | 49 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) { |
| 51 #if defined OS_CHROMEOS | 50 #if defined OS_CHROMEOS |
| 52 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); | 51 test_user_manager_.reset(new chromeos::ScopedTestUserManager()); |
| 53 #endif | 52 #endif |
| 54 base::CommandLine no_program_command_line(base::CommandLine::NO_PROGRAM); | 53 base::CommandLine no_program_command_line(base::CommandLine::NO_PROGRAM); |
| (...skipping 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 816 for (int i = 0; i < 305; i++) { | 815 for (int i = 0; i < 305; i++) { |
| 817 scoped_refptr<Action> action = | 816 scoped_refptr<Action> action = |
| 818 new Action("punky", | 817 new Action("punky", |
| 819 base::Time::Now(), | 818 base::Time::Now(), |
| 820 Action::ACTION_API_CALL, | 819 Action::ACTION_API_CALL, |
| 821 base::StringPrintf("apicall_%d", i)); | 820 base::StringPrintf("apicall_%d", i)); |
| 822 policy->ProcessAction(action); | 821 policy->ProcessAction(action); |
| 823 } | 822 } |
| 824 | 823 |
| 825 policy->Flush(); | 824 policy->Flush(); |
| 826 BrowserThread::PostTaskAndReply( | 825 GetActivityLogTaskRunner()->PostTaskAndReply( |
| 827 BrowserThread::DB, FROM_HERE, base::BindOnce(&base::DoNothing), | 826 FROM_HERE, base::BindOnce(&base::DoNothing), |
| 828 base::MessageLoop::current()->QuitWhenIdleClosure()); | 827 base::MessageLoop::current()->QuitWhenIdleClosure()); |
| 829 base::RunLoop().Run(); | 828 base::RunLoop().Run(); |
| 830 | 829 |
| 831 CheckReadFilteredData( | 830 CheckReadFilteredData( |
| 832 policy, | 831 policy, |
| 833 "punky", | 832 "punky", |
| 834 Action::ACTION_ANY, | 833 Action::ACTION_ANY, |
| 835 "", | 834 "", |
| 836 "", | 835 "", |
| 837 "", | 836 "", |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 942 action_ids.push_back(3); | 941 action_ids.push_back(3); |
| 943 action_ids.push_back(4); | 942 action_ids.push_back(4); |
| 944 CheckRemoveActions( | 943 CheckRemoveActions( |
| 945 policy, action_ids, base::Bind(&FullStreamUIPolicyTest::Action2Deleted)); | 944 policy, action_ids, base::Bind(&FullStreamUIPolicyTest::Action2Deleted)); |
| 946 action_ids.clear(); | 945 action_ids.clear(); |
| 947 | 946 |
| 948 policy->Close(); | 947 policy->Close(); |
| 949 } | 948 } |
| 950 | 949 |
| 951 } // namespace extensions | 950 } // namespace extensions |
| OLD | NEW |