| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 <list> | 5 #include <list> |
| 6 #include <set> | 6 #include <set> |
| 7 | 7 |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 // An UI-less RenderViewContextMenu. | 50 // An UI-less RenderViewContextMenu. |
| 51 class TestRenderViewContextMenu : public RenderViewContextMenu { | 51 class TestRenderViewContextMenu : public RenderViewContextMenu { |
| 52 public: | 52 public: |
| 53 TestRenderViewContextMenu(WebContents* web_contents, | 53 TestRenderViewContextMenu(WebContents* web_contents, |
| 54 const content::ContextMenuParams& params) | 54 const content::ContextMenuParams& params) |
| 55 : RenderViewContextMenu(web_contents, params) { | 55 : RenderViewContextMenu(web_contents, params) { |
| 56 } | 56 } |
| 57 virtual ~TestRenderViewContextMenu() {} | 57 virtual ~TestRenderViewContextMenu() {} |
| 58 | 58 |
| 59 private: | 59 private: |
| 60 virtual void PlatformInit() {} | 60 virtual void PlatformInit() OVERRIDE {} |
| 61 virtual void PlatformCancel() {} | 61 virtual void PlatformCancel() OVERRIDE {} |
| 62 virtual bool GetAcceleratorForCommandId(int, ui::Accelerator*) { | 62 virtual bool GetAcceleratorForCommandId(int, ui::Accelerator*) OVERRIDE { |
| 63 return false; | 63 return false; |
| 64 } | 64 } |
| 65 | 65 |
| 66 DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu); | 66 DISALLOW_COPY_AND_ASSIGN(TestRenderViewContextMenu); |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 | 69 |
| 70 // This class can defer requests for arbitrary URLs. | 70 // This class can defer requests for arbitrary URLs. |
| 71 class TestNavigationListener | 71 class TestNavigationListener |
| 72 : public base::RefCountedThreadSafe<TestNavigationListener> { | 72 : public base::RefCountedThreadSafe<TestNavigationListener> { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 | 124 |
| 125 // Stores a throttle per URL request that we have delayed. | 125 // Stores a throttle per URL request that we have delayed. |
| 126 class Throttle : public content::ResourceThrottle, | 126 class Throttle : public content::ResourceThrottle, |
| 127 public base::SupportsWeakPtr<Throttle> { | 127 public base::SupportsWeakPtr<Throttle> { |
| 128 public: | 128 public: |
| 129 void Resume() { | 129 void Resume() { |
| 130 controller()->Resume(); | 130 controller()->Resume(); |
| 131 } | 131 } |
| 132 | 132 |
| 133 // content::ResourceThrottle implementation. | 133 // content::ResourceThrottle implementation. |
| 134 virtual void WillStartRequest(bool* defer) { | 134 virtual void WillStartRequest(bool* defer) OVERRIDE { |
| 135 *defer = true; | 135 *defer = true; |
| 136 } | 136 } |
| 137 }; | 137 }; |
| 138 typedef base::WeakPtr<Throttle> WeakThrottle; | 138 typedef base::WeakPtr<Throttle> WeakThrottle; |
| 139 typedef std::list<WeakThrottle> WeakThrottleList; | 139 typedef std::list<WeakThrottle> WeakThrottleList; |
| 140 WeakThrottleList throttles_; | 140 WeakThrottleList throttles_; |
| 141 | 141 |
| 142 // The set of URLs to be delayed. | 142 // The set of URLs to be delayed. |
| 143 std::set<GURL> urls_to_delay_; | 143 std::set<GURL> urls_to_delay_; |
| 144 | 144 |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 url = GURL(base::StringPrintf( | 718 url = GURL(base::StringPrintf( |
| 719 "http://www.a.com:%d/" | 719 "http://www.a.com:%d/" |
| 720 "files/extensions/api_test/webnavigation/crash/b.html", | 720 "files/extensions/api_test/webnavigation/crash/b.html", |
| 721 test_server()->host_port_pair().port())); | 721 test_server()->host_port_pair().port())); |
| 722 ui_test_utils::NavigateToURL(browser(), url); | 722 ui_test_utils::NavigateToURL(browser(), url); |
| 723 | 723 |
| 724 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); | 724 ASSERT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 725 } | 725 } |
| 726 | 726 |
| 727 } // namespace extensions | 727 } // namespace extensions |
| OLD | NEW |