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

Unified Diff: chrome/browser/extensions/activity_log/fullstream_ui_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/fullstream_ui_policy_unittest.cc
diff --git a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
index 5dc6445b6221576ea2703fe939e84fa65498c0b1..874c2bc421e430a896a1d1a5b52694b9efbd6ac3 100644
--- a/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc
@@ -60,35 +60,15 @@ class FullStreamUIPolicyTest : public testing::Test {
*CommandLine::ForCurrentProcess() = saved_cmdline_;
}
- // 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,
- const int day,
+ 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(&FullStreamUIPolicyTest::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(&FullStreamUIPolicyTest::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
@@ -100,6 +80,7 @@ class FullStreamUIPolicyTest : public testing::Test {
const std::string& api_name,
const std::string& page_url,
const std::string& arg_url,
+ const int days_ago,
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
@@ -110,6 +91,7 @@ class FullStreamUIPolicyTest : public testing::Test {
api_name,
page_url,
arg_url,
+ days_ago,
base::Bind(&FullStreamUIPolicyTest::CheckWrapper,
checker,
base::MessageLoop::current()->QuitClosure()));
@@ -341,6 +323,7 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) {
"tabs.testMethod",
"",
"",
+ -1,
base::Bind(
&FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -351,6 +334,7 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) {
"",
"",
"",
+ -1,
base::Bind(
&FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -361,6 +345,7 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) {
"",
"http://www.google.com/",
"",
+ -1,
base::Bind(
&FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -371,6 +356,7 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) {
"",
"http://www.google.com",
"",
+ -1,
base::Bind(
&FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -381,6 +367,7 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) {
"",
"http://www.goo",
"",
+ -1,
base::Bind(
&FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions1));
@@ -391,6 +378,7 @@ TEST_F(FullStreamUIPolicyTest, LogAndFetchFilteredActions) {
"",
"",
"",
+ -1,
base::Bind(
&FullStreamUIPolicyTest::RetrieveActions_FetchFilteredActions2));

Powered by Google App Engine
This is Rietveld 408576698