summaryrefslogtreecommitdiffstats
path: root/chrome/browser/mock_browsing_data_cookie_helper.h
diff options
context:
space:
mode:
authorycxiao@chromium.org <ycxiao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 17:09:17 +0000
committerycxiao@chromium.org <ycxiao@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 17:09:17 +0000
commit7dd2b87199f491e790d87451408de40021818e15 (patch)
tree4a84064785aeadca4c3439a533897d67980262a8 /chrome/browser/mock_browsing_data_cookie_helper.h
parent7799ffda6e3d514df19949502bdec717c1b629c4 (diff)
downloadchromium_src-7dd2b87199f491e790d87451408de40021818e15.zip
chromium_src-7dd2b87199f491e790d87451408de40021818e15.tar.gz
chromium_src-7dd2b87199f491e790d87451408de40021818e15.tar.bz2
Creat BrowsingDataCookieHelper and CannedBrowsingDataCookieHelper for logging cookies at UI thread.
Moving from http://codereview.chromium.org/7355025/ BUG=XXXX TEST=BrowsingDataCookieHelperTest TBR=rdsmith Review URL: http://codereview.chromium.org/7601018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96569 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/mock_browsing_data_cookie_helper.h')
-rw-r--r--chrome/browser/mock_browsing_data_cookie_helper.h50
1 files changed, 50 insertions, 0 deletions
diff --git a/chrome/browser/mock_browsing_data_cookie_helper.h b/chrome/browser/mock_browsing_data_cookie_helper.h
new file mode 100644
index 0000000..723e9b5
--- /dev/null
+++ b/chrome/browser/mock_browsing_data_cookie_helper.h
@@ -0,0 +1,50 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_MOCK_BROWSING_DATA_COOKIE_HELPER_H_
+#define CHROME_BROWSER_MOCK_BROWSING_DATA_COOKIE_HELPER_H_
+#pragma once
+
+#include <map>
+#include <string>
+
+#include "chrome/browser/browsing_data_cookie_helper.h"
+
+// Mock for BrowsingDataCookieHelper.
+class MockBrowsingDataCookieHelper : public BrowsingDataCookieHelper {
+ public:
+ explicit MockBrowsingDataCookieHelper(Profile* profile);
+
+ // BrowsingDataCookieHelper methods.
+ virtual void StartFetching(
+ const net::CookieMonster::GetCookieListCallback &callback);
+ virtual void CancelNotification();
+ virtual void DeleteCookie(const net::CookieMonster::CanonicalCookie& cookie);
+
+ // Adds some cookie samples.
+ void AddCookieSamples(const GURL& url, const std::string& cookie_line);
+
+ // Notifies the callback.
+ void Notify();
+
+ // Marks all cookies as existing.
+ void Reset();
+
+ // Returns true if all cookies since the last Reset() invocation were
+ // deleted.
+ bool AllDeleted();
+
+ private:
+ virtual ~MockBrowsingDataCookieHelper();
+
+ Profile* profile_;
+ net::CookieMonster::GetCookieListCallback callback_;
+
+ net::CookieList cookie_list_;
+
+ // Stores which cookies exist.
+ std::map<const std::string, bool> cookies_;
+};
+
+#endif // CHROME_BROWSER_MOCK_BROWSING_DATA_COOKIE_HELPER_H_