| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" | 10 #include "content/browser/compositor/test/no_transport_image_transport_factory.h
" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 ~RenderFrameHostManagerTestWebUIControllerFactory() override {} | 59 ~RenderFrameHostManagerTestWebUIControllerFactory() override {} |
| 60 | 60 |
| 61 void set_should_create_webui(bool should_create_webui) { | 61 void set_should_create_webui(bool should_create_webui) { |
| 62 should_create_webui_ = should_create_webui; | 62 should_create_webui_ = should_create_webui; |
| 63 } | 63 } |
| 64 | 64 |
| 65 // WebUIFactory implementation. | 65 // WebUIFactory implementation. |
| 66 WebUIController* CreateWebUIControllerForURL(WebUI* web_ui, | 66 WebUIController* CreateWebUIControllerForURL(WebUI* web_ui, |
| 67 const GURL& url) const override { | 67 const GURL& url) const override { |
| 68 if (!(should_create_webui_ && HasWebUIScheme(url))) | 68 // If WebUI creation is enabled for the test and this is a WebUI URL, |
| 69 return NULL; | 69 // returns a new instance. |
| 70 return new WebUIController(web_ui); | 70 if (should_create_webui_ && HasWebUIScheme(url)) |
| 71 return new WebUIController(web_ui); |
| 72 return nullptr; |
| 71 } | 73 } |
| 72 | 74 |
| 73 WebUI::TypeID GetWebUIType(BrowserContext* browser_context, | 75 WebUI::TypeID GetWebUIType(BrowserContext* browser_context, |
| 74 const GURL& url) const override { | 76 const GURL& url) const override { |
| 77 // If WebUI creation is enabled for the test and this is a WebUI URL, |
| 78 // returns a mock WebUI type. |
| 79 if (should_create_webui_ && HasWebUIScheme(url)) { |
| 80 return const_cast<RenderFrameHostManagerTestWebUIControllerFactory*>( |
| 81 this); |
| 82 } |
| 75 return WebUI::kNoWebUI; | 83 return WebUI::kNoWebUI; |
| 76 } | 84 } |
| 77 | 85 |
| 78 bool UseWebUIForURL(BrowserContext* browser_context, | 86 bool UseWebUIForURL(BrowserContext* browser_context, |
| 79 const GURL& url) const override { | 87 const GURL& url) const override { |
| 80 return HasWebUIScheme(url); | 88 return HasWebUIScheme(url); |
| 81 } | 89 } |
| 82 | 90 |
| 83 bool UseWebUIBindingsForURL(BrowserContext* browser_context, | 91 bool UseWebUIBindingsForURL(BrowserContext* browser_context, |
| 84 const GURL& url) const override { | 92 const GURL& url) const override { |
| (...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2474 EXPECT_EQ(tree4, opener_frame_trees[3]); | 2482 EXPECT_EQ(tree4, opener_frame_trees[3]); |
| 2475 | 2483 |
| 2476 EXPECT_EQ(2U, nodes_with_back_links.size()); | 2484 EXPECT_EQ(2U, nodes_with_back_links.size()); |
| 2477 EXPECT_TRUE(nodes_with_back_links.find(root1->child_at(1)) != | 2485 EXPECT_TRUE(nodes_with_back_links.find(root1->child_at(1)) != |
| 2478 nodes_with_back_links.end()); | 2486 nodes_with_back_links.end()); |
| 2479 EXPECT_TRUE(nodes_with_back_links.find(root4->child_at(0)) != | 2487 EXPECT_TRUE(nodes_with_back_links.find(root4->child_at(0)) != |
| 2480 nodes_with_back_links.end()); | 2488 nodes_with_back_links.end()); |
| 2481 } | 2489 } |
| 2482 | 2490 |
| 2483 } // namespace content | 2491 } // namespace content |
| OLD | NEW |