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

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

Issue 23874008: Added memory limit for chrome.activityLogPrivate returned results (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..d71feaf687ab09243ecfe593b58af5f6abbb8026 100644
--- a/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
+++ b/chrome/browser/extensions/activity_log/counting_policy_unittest.cc
@@ -186,6 +186,11 @@ class CountingPolicyTest : public testing::Test {
ASSERT_EQ(2, static_cast<int>(i->size()));
}
+ static void RetrieveActions_FetchFilteredActions300(
+ scoped_ptr<std::vector<scoped_refptr<Action> > > i) {
+ ASSERT_EQ(300, static_cast<int>(i->size()));
+ }
+
static void Arguments_Stripped(scoped_ptr<Action::ActionVector> i) {
scoped_refptr<Action> last = i->front();
std::string args =
@@ -782,6 +787,31 @@ TEST_F(CountingPolicyTest, EarlyFlush) {
policy->Close();
}
+TEST_F(CountingPolicyTest, CapReturns) {
+ CountingPolicy* policy = new CountingPolicy(profile_.get());
+
+ for (int i = 0; i < 305; i++) {
+ scoped_refptr<Action> action =
+ new Action("punky",
+ base::Time::Now(),
+ Action::ACTION_API_CALL,
+ base::StringPrintf("apicall_%d", i));
+ policy->ProcessAction(action);
+ }
+ policy->Flush();
+
+ CheckReadFilteredData(
+ policy,
+ "punky",
+ Action::ACTION_ANY,
+ "",
+ "",
+ "",
+ base::Bind(
+ &CountingPolicyTest::RetrieveActions_FetchFilteredActions300));
+ policy->Close();
+}
+
TEST_F(CountingPolicyTest, RemoveAllURLs) {
ActivityLogPolicy* policy = new CountingPolicy(profile_.get());

Powered by Google App Engine
This is Rietveld 408576698