Only grant permissions to new extensions from sync if they have the expected version
[chromium-blink-merge.git] / chrome / browser / browsing_data / mock_browsing_data_local_storage_helper.h
blob3d3cb1d185e1c2729030aecba26030847de4dbc7
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
6 #define CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_
8 #include <list>
9 #include <map>
11 #include "base/callback.h"
12 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
14 // Mock for BrowsingDataLocalStorageHelper.
15 // Use AddLocalStorageSamples() or add directly to response_ list, then
16 // call Notify().
17 class MockBrowsingDataLocalStorageHelper
18 : public BrowsingDataLocalStorageHelper {
19 public:
20 explicit MockBrowsingDataLocalStorageHelper(Profile* profile);
22 // BrowsingDataLocalStorageHelper implementation.
23 void StartFetching(const FetchCallback& callback) override;
24 void DeleteOrigin(const GURL& origin) override;
26 // Adds some LocalStorageInfo samples.
27 void AddLocalStorageSamples();
29 // Notifies the callback.
30 void Notify();
32 // Marks all local storage files as existing.
33 void Reset();
35 // Returns true if all local storage files were deleted since the last Reset()
36 // invocation.
37 bool AllDeleted();
39 GURL last_deleted_origin_;
41 private:
42 ~MockBrowsingDataLocalStorageHelper() override;
44 FetchCallback callback_;
46 std::map<const GURL, bool> origins_;
48 std::list<LocalStorageInfo> response_;
50 DISALLOW_COPY_AND_ASSIGN(MockBrowsingDataLocalStorageHelper);
53 #endif // CHROME_BROWSER_BROWSING_DATA_MOCK_BROWSING_DATA_LOCAL_STORAGE_HELPER_H_