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

Unified Diff: chrome/browser/extensions/activity_log/counting_policy_unittest.cc

Issue 23980002: Activity Log: allow searching by day (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/activity_log/counting_policy_unittest.cc
diff --git a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
index dbd55a41aa0f99e5c4370a905d179462bfa13a44..37e6703cbea7ded9fc4f09761d357d719ba7f89b 100644
--- a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
@@ -70,35 +70,15 @@ class CountingPolicyTest : public testing::Test {
base::MessageLoop::current()->Run();
}
- // A helper function to call ReadData on a policy object and wait for the
- // results to be processed.
+ // A wrapper function for CheckReadFilteredData, so that we don't need to
+ // enter empty string values for parameters we don't care about.
void CheckReadData(
ActivityLogPolicy* policy,
const std::string& extension_id,
int day,
const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker) {
- // Submit a request to the policy to read back some data, and call the
- // checker function when results are available. This will happen on the
- // database thread.
- policy->ReadData(
- extension_id,
- day,
- base::Bind(&CountingPolicyTest::CheckWrapper,
- checker,
- base::MessageLoop::current()->QuitClosure()));
-
- // Set up a timeout that will trigger after 5 seconds; if we haven't
- // received any results by then assume that the test is broken.
- base::CancelableClosure timeout(
- base::Bind(&CountingPolicyTest::TimeoutCallback));
- base::MessageLoop::current()->PostDelayedTask(
- FROM_HERE, timeout.callback(), base::TimeDelta::FromSeconds(5));
-
- // Wait for results; either the checker or the timeout callbacks should
- // cause the main loop to exit.
- base::MessageLoop::current()->Run();
-
- timeout.Cancel();
+ CheckReadFilteredData(
+ policy, extension_id, Action::ACTION_ANY, "", "", "", day, checker);
}
// A helper function to call ReadFilteredData on a policy object and wait for
@@ -110,6 +90,7 @@ class CountingPolicyTest : public testing::Test {
const std::string& api_name,
const std::string& page_url,
const std::string& arg_url,
+ int day,
const base::Callback<void(scoped_ptr<Action::ActionVector>)>& checker) {
// Submit a request to the policy to read back some data, and call the
// checker function when results are available. This will happen on the
@@ -120,6 +101,7 @@ class CountingPolicyTest : public testing::Test {
api_name,
page_url,
arg_url,
+ day,
base::Bind(&CountingPolicyTest::CheckWrapper,
checker,
base::MessageLoop::current()->QuitClosure()));
@@ -508,6 +490,7 @@ TEST_F(CountingPolicyTest, LogAndFetchFilteredActions) {
"tabs.testMethod",
"",
"",
+ -1,
base::Bind(
&CountingPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -518,6 +501,7 @@ TEST_F(CountingPolicyTest, LogAndFetchFilteredActions) {
"",
"",
"",
+ -1,
base::Bind(
&CountingPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -528,6 +512,7 @@ TEST_F(CountingPolicyTest, LogAndFetchFilteredActions) {
"",
"http://www.google.com/",
"",
+ -1,
base::Bind(
&CountingPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -538,6 +523,7 @@ TEST_F(CountingPolicyTest, LogAndFetchFilteredActions) {
"",
"http://www.google.com",
"",
+ -1,
base::Bind(
&CountingPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -548,6 +534,7 @@ TEST_F(CountingPolicyTest, LogAndFetchFilteredActions) {
"",
"http://www.goo",
"",
+ -1,
base::Bind(
&CountingPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -558,6 +545,7 @@ TEST_F(CountingPolicyTest, LogAndFetchFilteredActions) {
"",
"",
"",
+ -1,
base::Bind(
&CountingPolicyTest::RetrieveActions_FetchFilteredActions2));

Powered by Google App Engine
This is Rietveld 408576698