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

Unified Diff: chrome/browser/ui/webui/web_ui_browsertest.cc

Issue 9224002: Make WebUI objects not derive from WebUI. WebUI objects own the controller. This is the ownership... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync to head to clear linux_chromeos browsertest failures Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/webui/web_ui_browsertest.cc
===================================================================
--- chrome/browser/ui/webui/web_ui_browsertest.cc (revision 117871)
+++ chrome/browser/ui/webui/web_ui_browsertest.cc (working copy)
@@ -268,31 +268,20 @@
DISALLOW_COPY_AND_ASSIGN(MockWebUIDataSource);
};
-// WebUI to attach the DataSource for the dummy URL.
-class MockWebUI : public WebUI {
- public:
- explicit MockWebUI(WebContents* contents, WebUIController* controller)
- : WebUI(contents, controller) {
- Profile* profile =
- Profile::FromBrowserContext(contents->GetBrowserContext());
- profile->GetChromeURLDataManager()->AddDataSource(
- new MockWebUIDataSource());
- }
-
- private:
- DISALLOW_COPY_AND_ASSIGN(MockWebUI);
-};
-
-// WebUIProvider to allow injection of our WebUI classes for the dummy URL when
+// WebUIProvider to allow attaching the DataSource for the dummy URL when
// testing.
class MockWebUIProvider : public TestChromeWebUIFactory::WebUIProvider {
public:
MockWebUIProvider() {}
// Returns a new WebUI
- WebUI* NewWebUI(WebContents* web_contents, const GURL& url) OVERRIDE {
- static content::WebUIController temp_controller;
- return new MockWebUI(web_contents, &temp_controller);
+ WebUIController* NewWebUI(WebUI* web_ui, const GURL& url) OVERRIDE {
+ WebUIController* controller = new content::WebUIController(web_ui);
+ Profile* profile = Profile::FromBrowserContext(
+ web_ui->web_contents()->GetBrowserContext());
+ profile->GetChromeURLDataManager()->AddDataSource(
+ new MockWebUIDataSource());
+ return controller;
}
private:

Powered by Google App Engine
This is Rietveld 408576698