OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
551 const GURL& GetPacURL() const OVERRIDE { | 551 const GURL& GetPacURL() const OVERRIDE { |
552 return dummy_gurl_; | 552 return dummy_gurl_; |
553 } | 553 } |
554 | 554 |
555 void CallbackWithFailure() { | 555 void CallbackWithFailure() { |
556 if (!callback_.is_null()) | 556 if (!callback_.is_null()) |
557 callback_.Run(ERR_PAC_NOT_IN_DHCP); | 557 callback_.Run(ERR_PAC_NOT_IN_DHCP); |
558 } | 558 } |
559 | 559 |
560 private: | 560 private: |
| 561 friend class base::RefCountedThreadSafe<AsyncFailDhcpFetcher>; |
| 562 ~AsyncFailDhcpFetcher() {} |
| 563 |
561 GURL dummy_gurl_; | 564 GURL dummy_gurl_; |
562 CompletionCallback callback_; | 565 CompletionCallback callback_; |
563 }; | 566 }; |
564 | 567 |
565 TEST(ProxyScriptDeciderTest, DhcpCancelledByDestructor) { | 568 TEST(ProxyScriptDeciderTest, DhcpCancelledByDestructor) { |
566 // This regression test would crash before | 569 // This regression test would crash before |
567 // http://codereview.chromium.org/7044058/ | 570 // http://codereview.chromium.org/7044058/ |
568 // Thus, we don't care much about actual results (hence no EXPECT or ASSERT | 571 // Thus, we don't care much about actual results (hence no EXPECT or ASSERT |
569 // macros below), just that it doesn't crash. | 572 // macros below), just that it doesn't crash. |
570 Rules rules; | 573 Rules rules; |
(...skipping 15 matching lines...) Expand all Loading... |
586 | 589 |
587 // Run the message loop to let the DHCP fetch complete and post the results | 590 // Run the message loop to let the DHCP fetch complete and post the results |
588 // back. Before the fix linked to above, this would try to invoke on | 591 // back. Before the fix linked to above, this would try to invoke on |
589 // the callback object provided by ProxyScriptDecider after it was | 592 // the callback object provided by ProxyScriptDecider after it was |
590 // no longer valid. | 593 // no longer valid. |
591 MessageLoop::current()->RunAllPending(); | 594 MessageLoop::current()->RunAllPending(); |
592 } | 595 } |
593 | 596 |
594 } // namespace | 597 } // namespace |
595 } // namespace net | 598 } // namespace net |
OLD | NEW |