| 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> |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 | 101 |
| 102 // Set up a timeout for receiving results; if we haven't received anything | 102 // Set up a timeout for receiving results; if we haven't received anything |
| 103 // when the timeout triggers then assume that the test is broken. | 103 // when the timeout triggers then assume that the test is broken. |
| 104 base::CancelableClosure timeout( | 104 base::CancelableClosure timeout( |
| 105 base::Bind(&FullStreamUIPolicyTest::TimeoutCallback)); | 105 base::Bind(&FullStreamUIPolicyTest::TimeoutCallback)); |
| 106 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( | 106 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 107 FROM_HERE, timeout.callback(), TestTimeouts::action_timeout()); | 107 FROM_HERE, timeout.callback(), TestTimeouts::action_timeout()); |
| 108 | 108 |
| 109 // Wait for results; either the checker or the timeout callbacks should | 109 // Wait for results; either the checker or the timeout callbacks should |
| 110 // cause the main loop to exit. | 110 // cause the main loop to exit. |
| 111 base::MessageLoop::current()->Run(); | 111 base::RunLoop().Run(); |
| 112 | 112 |
| 113 timeout.Cancel(); | 113 timeout.Cancel(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 static void CheckWrapper(const base::Callback<void( | 116 static void CheckWrapper(const base::Callback<void( |
| 117 std::unique_ptr<Action::ActionVector>)>& checker, | 117 std::unique_ptr<Action::ActionVector>)>& checker, |
| 118 const base::Closure& done, | 118 const base::Closure& done, |
| 119 std::unique_ptr<Action::ActionVector> results) { | 119 std::unique_ptr<Action::ActionVector> results) { |
| 120 checker.Run(std::move(results)); | 120 checker.Run(std::move(results)); |
| 121 done.Run(); | 121 done.Run(); |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 base::Time::Now(), | 926 base::Time::Now(), |
| 927 Action::ACTION_API_CALL, | 927 Action::ACTION_API_CALL, |
| 928 base::StringPrintf("apicall_%d", i)); | 928 base::StringPrintf("apicall_%d", i)); |
| 929 policy->ProcessAction(action); | 929 policy->ProcessAction(action); |
| 930 } | 930 } |
| 931 | 931 |
| 932 policy->Flush(); | 932 policy->Flush(); |
| 933 BrowserThread::PostTaskAndReply( | 933 BrowserThread::PostTaskAndReply( |
| 934 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), | 934 BrowserThread::DB, FROM_HERE, base::Bind(&base::DoNothing), |
| 935 base::MessageLoop::current()->QuitWhenIdleClosure()); | 935 base::MessageLoop::current()->QuitWhenIdleClosure()); |
| 936 base::MessageLoop::current()->Run(); | 936 base::RunLoop().Run(); |
| 937 | 937 |
| 938 CheckReadFilteredData( | 938 CheckReadFilteredData( |
| 939 policy, | 939 policy, |
| 940 "punky", | 940 "punky", |
| 941 Action::ACTION_ANY, | 941 Action::ACTION_ANY, |
| 942 "", | 942 "", |
| 943 "", | 943 "", |
| 944 "", | 944 "", |
| 945 -1, | 945 -1, |
| 946 base::Bind( | 946 base::Bind( |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1049 action_ids.push_back(3); | 1049 action_ids.push_back(3); |
| 1050 action_ids.push_back(4); | 1050 action_ids.push_back(4); |
| 1051 CheckRemoveActions( | 1051 CheckRemoveActions( |
| 1052 policy, action_ids, base::Bind(&FullStreamUIPolicyTest::Action2Deleted)); | 1052 policy, action_ids, base::Bind(&FullStreamUIPolicyTest::Action2Deleted)); |
| 1053 action_ids.clear(); | 1053 action_ids.clear(); |
| 1054 | 1054 |
| 1055 policy->Close(); | 1055 policy->Close(); |
| 1056 } | 1056 } |
| 1057 | 1057 |
| 1058 } // namespace extensions | 1058 } // namespace extensions |
| OLD | NEW |