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

Side by Side Diff: content/test/weburl_loader_mock.h

Issue 1743783002: Use WeakPtr and do not use pointer equality in WebURLLoaderMockFactory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@Loader_URLTestHelpers
Patch Set: Rebase. Created 4 years, 10 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 | content/test/weburl_loader_mock.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CONTENT_TEST_WEBURL_LOADER_MOCK_H_ 5 #ifndef CONTENT_TEST_WEBURL_LOADER_MOCK_H_
6 #define CONTENT_TEST_WEBURL_LOADER_MOCK_H_ 6 #define CONTENT_TEST_WEBURL_LOADER_MOCK_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void loadSynchronously(const blink::WebURLRequest& request, 47 void loadSynchronously(const blink::WebURLRequest& request,
48 blink::WebURLResponse& response, 48 blink::WebURLResponse& response,
49 blink::WebURLError& error, 49 blink::WebURLError& error,
50 blink::WebData& data) override; 50 blink::WebData& data) override;
51 void loadAsynchronously(const blink::WebURLRequest& request, 51 void loadAsynchronously(const blink::WebURLRequest& request,
52 blink::WebURLLoaderClient* client) override; 52 blink::WebURLLoaderClient* client) override;
53 void cancel() override; 53 void cancel() override;
54 void setDefersLoading(bool defer) override; 54 void setDefersLoading(bool defer) override;
55 55
56 bool isDeferred() { return is_deferred_; } 56 bool isDeferred() { return is_deferred_; }
57 bool isCancelled() { return !client_; }
jam 2016/02/29 16:41:09 nit: these two should be is_deferred() and is_canc
hiroshige 2016/02/29 21:21:55 Done.
57 58
58 void setLoadingTaskRunner(blink::WebTaskRunner*) override; 59 void setLoadingTaskRunner(blink::WebTaskRunner*) override;
59 60
61 base::WeakPtr<WebURLLoaderMock> GetWeakPtr();
62
60 private: 63 private:
61 WebURLLoaderMockFactory* factory_; 64 WebURLLoaderMockFactory* factory_;
62 blink::WebURLLoaderClient* client_; 65 blink::WebURLLoaderClient* client_;
63 scoped_ptr<blink::WebURLLoader> default_loader_; 66 scoped_ptr<blink::WebURLLoader> default_loader_;
64 bool using_default_loader_; 67 bool using_default_loader_;
65 bool is_deferred_; 68 bool is_deferred_;
66 69
67 base::WeakPtrFactory<WebURLLoaderMock> weak_factory_; 70 base::WeakPtrFactory<WebURLLoaderMock> weak_factory_;
68 71
69 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMock); 72 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMock);
70 }; 73 };
71 74
72 #endif // CONTENT_TEST_WEBURL_LOADER_MOCK_H_ 75 #endif // CONTENT_TEST_WEBURL_LOADER_MOCK_H_
OLDNEW
« no previous file with comments | « no previous file | content/test/weburl_loader_mock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698