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

Side by Side Diff: chrome/test/base/web_ui_browser_test.cc

Issue 637933002: Replace FINAL and OVERRIDE with their C++11 counterparts in chrome/test (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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test/base/web_ui_browser_test.h" 5 #include "chrome/test/base/web_ui_browser_test.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 public: 64 public:
65 WebUIJsInjectionReadyObserver(content::WebContents* web_contents, 65 WebUIJsInjectionReadyObserver(content::WebContents* web_contents,
66 WebUIBrowserTest* browser_test, 66 WebUIBrowserTest* browser_test,
67 const std::string& preload_test_fixture, 67 const std::string& preload_test_fixture,
68 const std::string& preload_test_name) 68 const std::string& preload_test_name)
69 : content::WebContentsObserver(web_contents), 69 : content::WebContentsObserver(web_contents),
70 browser_test_(browser_test), 70 browser_test_(browser_test),
71 preload_test_fixture_(preload_test_fixture), 71 preload_test_fixture_(preload_test_fixture),
72 preload_test_name_(preload_test_name) {} 72 preload_test_name_(preload_test_name) {}
73 73
74 virtual void RenderViewCreated(content::RenderViewHost* rvh) OVERRIDE { 74 virtual void RenderViewCreated(content::RenderViewHost* rvh) override {
75 browser_test_->PreLoadJavascriptLibraries( 75 browser_test_->PreLoadJavascriptLibraries(
76 preload_test_fixture_, preload_test_name_, rvh); 76 preload_test_fixture_, preload_test_name_, rvh);
77 } 77 }
78 78
79 private: 79 private:
80 WebUIBrowserTest* browser_test_; 80 WebUIBrowserTest* browser_test_;
81 std::string preload_test_fixture_; 81 std::string preload_test_fixture_;
82 std::string preload_test_name_; 82 std::string preload_test_name_;
83 }; 83 };
84 84
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 message_loop_runner_(new content::MessageLoopRunner) {} 236 message_loop_runner_(new content::MessageLoopRunner) {}
237 237
238 void Wait() { 238 void Wait() {
239 message_loop_runner_->Run(); 239 message_loop_runner_->Run();
240 content::WaitForLoadStop(preview_dialog_); 240 content::WaitForLoadStop(preview_dialog_);
241 } 241 }
242 242
243 private: 243 private:
244 // ChromeContentBrowserClient implementation: 244 // ChromeContentBrowserClient implementation:
245 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate( 245 virtual content::WebContentsViewDelegate* GetWebContentsViewDelegate(
246 content::WebContents* web_contents) OVERRIDE { 246 content::WebContents* web_contents) override {
247 preview_dialog_ = web_contents; 247 preview_dialog_ = web_contents;
248 observer_.reset(new WebUIJsInjectionReadyObserver(preview_dialog_, 248 observer_.reset(new WebUIJsInjectionReadyObserver(preview_dialog_,
249 browser_test_, 249 browser_test_,
250 preload_test_fixture_, 250 preload_test_fixture_,
251 preload_test_name_)); 251 preload_test_name_));
252 message_loop_runner_->Quit(); 252 message_loop_runner_->Quit();
253 return NULL; 253 return NULL;
254 } 254 }
255 255
256 WebUIBrowserTest* browser_test_; 256 WebUIBrowserTest* browser_test_;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // page is shown. While this doesn't matter for most tests, without it, 312 // page is shown. While this doesn't matter for most tests, without it,
313 // navigation to different anchors cannot be listened to (via the hashchange 313 // navigation to different anchors cannot be listened to (via the hashchange
314 // event). 314 // event).
315 class MockWebUIDataSource : public content::URLDataSource { 315 class MockWebUIDataSource : public content::URLDataSource {
316 public: 316 public:
317 MockWebUIDataSource() {} 317 MockWebUIDataSource() {}
318 318
319 private: 319 private:
320 virtual ~MockWebUIDataSource() {} 320 virtual ~MockWebUIDataSource() {}
321 321
322 virtual std::string GetSource() const OVERRIDE { return "dummyurl"; } 322 virtual std::string GetSource() const override { return "dummyurl"; }
323 323
324 virtual void StartDataRequest( 324 virtual void StartDataRequest(
325 const std::string& path, 325 const std::string& path,
326 int render_process_id, 326 int render_process_id,
327 int render_frame_id, 327 int render_frame_id,
328 const content::URLDataSource::GotDataCallback& callback) OVERRIDE { 328 const content::URLDataSource::GotDataCallback& callback) override {
329 std::string dummy_html = "<html><body>Dummy</body></html>"; 329 std::string dummy_html = "<html><body>Dummy</body></html>";
330 scoped_refptr<base::RefCountedString> response = 330 scoped_refptr<base::RefCountedString> response =
331 base::RefCountedString::TakeString(&dummy_html); 331 base::RefCountedString::TakeString(&dummy_html);
332 callback.Run(response.get()); 332 callback.Run(response.get());
333 } 333 }
334 334
335 virtual std::string GetMimeType(const std::string& path) const OVERRIDE { 335 virtual std::string GetMimeType(const std::string& path) const override {
336 return "text/html"; 336 return "text/html";
337 } 337 }
338 338
339 DISALLOW_COPY_AND_ASSIGN(MockWebUIDataSource); 339 DISALLOW_COPY_AND_ASSIGN(MockWebUIDataSource);
340 }; 340 };
341 341
342 // WebUIProvider to allow attaching the DataSource for the dummy URL when 342 // WebUIProvider to allow attaching the DataSource for the dummy URL when
343 // testing. 343 // testing.
344 class MockWebUIProvider 344 class MockWebUIProvider
345 : public TestChromeWebUIControllerFactory::WebUIProvider { 345 : public TestChromeWebUIControllerFactory::WebUIProvider {
346 public: 346 public:
347 MockWebUIProvider() {} 347 MockWebUIProvider() {}
348 348
349 // Returns a new WebUI 349 // Returns a new WebUI
350 virtual WebUIController* NewWebUI(content::WebUI* web_ui, 350 virtual WebUIController* NewWebUI(content::WebUI* web_ui,
351 const GURL& url) OVERRIDE { 351 const GURL& url) override {
352 WebUIController* controller = new content::WebUIController(web_ui); 352 WebUIController* controller = new content::WebUIController(web_ui);
353 Profile* profile = Profile::FromWebUI(web_ui); 353 Profile* profile = Profile::FromWebUI(web_ui);
354 content::URLDataSource::Add(profile, new MockWebUIDataSource()); 354 content::URLDataSource::Add(profile, new MockWebUIDataSource());
355 return controller; 355 return controller;
356 } 356 }
357 357
358 private: 358 private:
359 DISALLOW_COPY_AND_ASSIGN(MockWebUIProvider); 359 DISALLOW_COPY_AND_ASSIGN(MockWebUIProvider);
360 }; 360 };
361 361
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 } 476 }
477 477
478 GURL WebUIBrowserTest::WebUITestDataPathToURL( 478 GURL WebUIBrowserTest::WebUITestDataPathToURL(
479 const base::FilePath::StringType& path) { 479 const base::FilePath::StringType& path) {
480 base::FilePath dir_test_data; 480 base::FilePath dir_test_data;
481 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data)); 481 EXPECT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &dir_test_data));
482 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path)); 482 base::FilePath test_path(dir_test_data.Append(kWebUITestFolder).Append(path));
483 EXPECT_TRUE(base::PathExists(test_path)); 483 EXPECT_TRUE(base::PathExists(test_path));
484 return net::FilePathToFileURL(test_path); 484 return net::FilePathToFileURL(test_path);
485 } 485 }
OLDNEW
« no previous file with comments | « chrome/test/base/web_ui_browser_test.h ('k') | chrome/test/base/web_ui_browser_test_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698