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

Side by Side Diff: chrome/browser/android/offline_pages/prerendering_offliner.h

Issue 2016313003: Adds unit tests for Offliner SavePage implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed Fake* to Stub* and added files to proper build target Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/prerendering_offliner.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_ 5 #ifndef CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_
6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_ 6 #define CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 24 matching lines...) Expand all
35 // Offliner implementation. 35 // Offliner implementation.
36 bool LoadAndSave(const SavePageRequest& request, 36 bool LoadAndSave(const SavePageRequest& request,
37 const CompletionCallback& callback) override; 37 const CompletionCallback& callback) override;
38 void Cancel() override; 38 void Cancel() override;
39 39
40 // Allows a loader to be injected for testing. This may only be done once 40 // Allows a loader to be injected for testing. This may only be done once
41 // and must be called before any of the Offliner interface methods are called. 41 // and must be called before any of the Offliner interface methods are called.
42 void SetLoaderForTesting(std::unique_ptr<PrerenderingLoader> loader); 42 void SetLoaderForTesting(std::unique_ptr<PrerenderingLoader> loader);
43 43
44 protected: 44 protected:
45 // Internal method for OfflinePageModel's check if url can be saved.
46 // Exposed for unit testing.
47 // TODO(dougarnett): Consider making OfflinePageModel mockable instead.
48 virtual bool CanSavePage(const GURL& url);
49
50 // Internal method for requesting OfflinePageModel to save page. 45 // Internal method for requesting OfflinePageModel to save page.
51 // Exposed for unit testing. 46 // Exposed for unit testing.
52 // TODO(dougarnett): Consider making OfflinePageModel mockable instead. 47 // TODO(dougarnett): Consider making OfflinePageModel mockable instead.
53 virtual void SavePage(const GURL& url, 48 virtual void SavePage(const GURL& url,
54 const ClientId& client_id, 49 const ClientId& client_id,
55 std::unique_ptr<OfflinePageArchiver> archiver, 50 std::unique_ptr<OfflinePageArchiver> archiver,
56 const SavePageCallback& callback); 51 const SavePageCallback& callback);
57 52
58 private: 53 private:
59 // Callback logic for PrerenderingLoader::LoadPage(). 54 // Callback logic for PrerenderingLoader::LoadPage().
(...skipping 23 matching lines...) Expand all
83 // case we receive a save page callback for an old, canceled request). 78 // case we receive a save page callback for an old, canceled request).
84 SavePageRequest const* pending_request_; 79 SavePageRequest const* pending_request_;
85 base::WeakPtrFactory<PrerenderingOffliner> weak_ptr_factory_; 80 base::WeakPtrFactory<PrerenderingOffliner> weak_ptr_factory_;
86 81
87 DISALLOW_COPY_AND_ASSIGN(PrerenderingOffliner); 82 DISALLOW_COPY_AND_ASSIGN(PrerenderingOffliner);
88 }; 83 };
89 84
90 } // namespace offline_pages 85 } // namespace offline_pages
91 86
92 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_ 87 #endif // CHROME_BROWSER_ANDROID_OFFLINE_PAGES_PRERENDERING_OFFLINER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/android/offline_pages/prerendering_offliner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698