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

Side by Side Diff: content/renderer/resource_fetcher_browsertest.cc

Issue 670683003: Standardize usage of virtual/override/final in content/renderer/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
OLDNEW
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 "content/public/renderer/resource_fetcher.h" 5 #include "content/public/renderer/resource_fetcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 bool timed_out_; 102 bool timed_out_;
103 WebURLResponse response_; 103 WebURLResponse response_;
104 std::string data_; 104 std::string data_;
105 base::Closure quit_task_; 105 base::Closure quit_task_;
106 }; 106 };
107 107
108 FetcherDelegate* FetcherDelegate::instance_ = NULL; 108 FetcherDelegate* FetcherDelegate::instance_ = NULL;
109 109
110 class EvilFetcherDelegate : public FetcherDelegate { 110 class EvilFetcherDelegate : public FetcherDelegate {
111 public: 111 public:
112 virtual ~EvilFetcherDelegate() {} 112 ~EvilFetcherDelegate() override {}
113 113
114 void SetFetcher(ResourceFetcher* fetcher) { 114 void SetFetcher(ResourceFetcher* fetcher) {
115 fetcher_.reset(fetcher); 115 fetcher_.reset(fetcher);
116 } 116 }
117 117
118 virtual void OnURLFetchComplete(const WebURLResponse& response, 118 void OnURLFetchComplete(const WebURLResponse& response,
119 const std::string& data) override { 119 const std::string& data) override {
120 FetcherDelegate::OnURLFetchComplete(response, data); 120 FetcherDelegate::OnURLFetchComplete(response, data);
121 121
122 // Destroy the ResourceFetcher here. We are testing that upon returning 122 // Destroy the ResourceFetcher here. We are testing that upon returning
123 // to the ResourceFetcher that it does not crash. This must be done after 123 // to the ResourceFetcher that it does not crash. This must be done after
124 // calling FetcherDelegate::OnURLFetchComplete, since deleting the fetcher 124 // calling FetcherDelegate::OnURLFetchComplete, since deleting the fetcher
125 // invalidates |response| and |data|. 125 // invalidates |response| and |data|.
126 fetcher_.reset(); 126 fetcher_.reset();
127 } 127 }
128 128
129 private: 129 private:
130 scoped_ptr<ResourceFetcher> fetcher_; 130 scoped_ptr<ResourceFetcher> fetcher_;
131 }; 131 };
132 132
133 class ResourceFetcherTests : public ContentBrowserTest { 133 class ResourceFetcherTests : public ContentBrowserTest {
134 public: 134 public:
135 virtual void SetUpCommandLine(CommandLine* command_line) override { 135 void SetUpCommandLine(CommandLine* command_line) override {
136 command_line->AppendSwitch(switches::kSingleProcess); 136 command_line->AppendSwitch(switches::kSingleProcess);
137 #if defined(OS_WIN) 137 #if defined(OS_WIN)
138 // Don't want to try to create a GPU process. 138 // Don't want to try to create a GPU process.
139 command_line->AppendSwitch(switches::kDisableGpu); 139 command_line->AppendSwitch(switches::kDisableGpu);
140 #endif 140 #endif
141 } 141 }
142 142
143 RenderView* GetRenderView() { 143 RenderView* GetRenderView() {
144 // We could have the test on the UI thread get the WebContent's routing ID, 144 // We could have the test on the UI thread get the WebContent's routing ID,
145 // but we know this will be the first RV so skip that and just hardcode it. 145 // but we know this will be the first RV so skip that and just hardcode it.
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 ASSERT_TRUE(test_server()->Start()); 401 ASSERT_TRUE(test_server()->Start());
402 GURL url(test_server()->GetURL("echoheader?header")); 402 GURL url(test_server()->GetURL("echoheader?header"));
403 403
404 PostTaskToInProcessRendererAndWait( 404 PostTaskToInProcessRendererAndWait(
405 base::Bind( 405 base::Bind(
406 &ResourceFetcherTests::ResourceFetcherSetHeader, 406 &ResourceFetcherTests::ResourceFetcherSetHeader,
407 base::Unretained(this), url)); 407 base::Unretained(this), url));
408 } 408 }
409 409
410 } // namespace content 410 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/renderer_webcolorchooser_impl.h ('k') | content/renderer/savable_resources_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698