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

Side by Side Diff: chrome/browser/web_resource/resource_request_allowed_notifier_test_util.cc

Issue 16841020: ResourceRequestAllowedNotifier didn't work as expected (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix resource_request_allowed_notifier_test_util.cc Created 7 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 | Annotate | Revision Log
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 #include "chrome/browser/web_resource/resource_request_allowed_notifier_test_uti l.h" 5 #include "chrome/browser/web_resource/resource_request_allowed_notifier_test_uti l.h"
6 6
7 TestRequestAllowedNotifier::TestRequestAllowedNotifier() 7 TestRequestAllowedNotifier::TestRequestAllowedNotifier()
8 : override_requests_allowed_(false), 8 : override_requests_allowed_(false),
9 requests_allowed_(true) { 9 requests_allowed_(true) {
10 } 10 }
(...skipping 11 matching lines...) Expand all
22 void TestRequestAllowedNotifier::SetRequestsAllowedOverride(bool allowed) { 22 void TestRequestAllowedNotifier::SetRequestsAllowedOverride(bool allowed) {
23 override_requests_allowed_ = true; 23 override_requests_allowed_ = true;
24 requests_allowed_ = allowed; 24 requests_allowed_ = allowed;
25 } 25 }
26 26
27 void TestRequestAllowedNotifier::NotifyObserver() { 27 void TestRequestAllowedNotifier::NotifyObserver() {
28 // Force the allowed state to true. This forces MaybeNotifyObserver to always 28 // Force the allowed state to true. This forces MaybeNotifyObserver to always
29 // notify observers, as MaybeNotifyObserver checks ResourceRequestsAllowed. 29 // notify observers, as MaybeNotifyObserver checks ResourceRequestsAllowed.
30 override_requests_allowed_ = true; 30 override_requests_allowed_ = true;
31 requests_allowed_ = true; 31 requests_allowed_ = true;
32 SetWaitingForNetworkForTesting(true);
33 ResourceRequestAllowedNotifier::ResourceRequestsAllowed();
34 SetWaitingForNetworkForTesting(false);
Alexei Svitkine (slow) 2013/06/17 17:36:13 So I think ResourceRequestsAllowed() should alread
Takashi Toyoshima 2013/06/18 07:21:05 OK, I'll add ForTesting method.
32 MaybeNotifyObserver(); 35 MaybeNotifyObserver();
33 } 36 }
34 37
35 bool TestRequestAllowedNotifier::ResourceRequestsAllowed() { 38 bool TestRequestAllowedNotifier::ResourceRequestsAllowed() {
36 // Call ResourceRequestAllowedNotifier::ResourceRequestsAllowed once to 39 // Call ResourceRequestAllowedNotifier::ResourceRequestsAllowed once to
37 // simulate that the user requested permission. Only return that result if 40 // simulate that the user requested permission. Only return that result if
38 // the override flag was set. 41 // the override flag was set.
Alexei Svitkine (slow) 2013/06/17 17:36:13 With this change, this comment becomes incorrect.
Takashi Toyoshima 2013/06/18 07:21:05 I fixed this function because it had two problems.
39 bool requests_allowed =
40 ResourceRequestAllowedNotifier::ResourceRequestsAllowed();
41 if (override_requests_allowed_) 42 if (override_requests_allowed_)
42 return requests_allowed_; 43 return requests_allowed_;
43 return requests_allowed; 44 return ResourceRequestAllowedNotifier::ResourceRequestsAllowed();
44 } 45 }
45 46
46 EulaAcceptedNotifier* TestRequestAllowedNotifier::CreateEulaNotifier() { 47 EulaAcceptedNotifier* TestRequestAllowedNotifier::CreateEulaNotifier() {
47 return test_eula_notifier_.release(); 48 return test_eula_notifier_.release();
48 } 49 }
49 50
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698