Chromium Code Reviews| Index: content/browser/web_contents/web_contents_impl_unittest.cc |
| diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc |
| index e6f350002cd63cb14e5454802dedf05dd167cf2b..48cf512a05d84a6925d09c67c91b06f8b3e61689 100644 |
| --- a/content/browser/web_contents/web_contents_impl_unittest.cc |
| +++ b/content/browser/web_contents/web_contents_impl_unittest.cc |
| @@ -405,8 +405,8 @@ TEST_F(WebContentsImplTest, UseTitleFromPendingEntryIfSet) { |
| EXPECT_EQ(title, contents()->GetTitle()); |
| } |
| -// Test view source mode for a webui page. |
| -TEST_F(WebContentsImplTest, NTPViewSource) { |
| +// A page shouldn't be able to open view-source for a webui page. |
| +TEST_F(WebContentsImplTest, ContentInitiatedViewSource) { |
| NavigationControllerImpl& cont = |
| static_cast<NavigationControllerImpl&>(controller()); |
| const char kUrl[] = "view-source:chrome://blah"; |
| @@ -414,10 +414,11 @@ TEST_F(WebContentsImplTest, NTPViewSource) { |
| process()->sink().ClearMessages(); |
| - cont.LoadURL( |
| - kGURL, Referrer(), ui::PAGE_TRANSITION_TYPED, std::string()); |
| + cont.LoadURL(kGURL, Referrer(), ui::PAGE_TRANSITION_LINK, std::string()); |
|
Charlie Reis
2016/05/16 22:22:18
The transition type doesn't make this a renderer-i
meacer
2016/05/19 01:13:54
This test is problematic in that it uses LoadURL i
Charlie Reis
2016/05/23 22:32:16
I definitely think it's worth testing both the bro
meacer
2016/05/23 23:57:47
Added multiple browser tests and a layout test.
|
| int entry_id = cont.GetPendingEntry()->GetUniqueID(); |
| // Did we get the expected message? |
| + // TODO(meacer): This probably shouldn't be true if we can't navigate to the |
| + // view-source URL. |
|
Charlie Reis
2016/05/16 22:22:18
Yeah, this would be concerning if it happened for
meacer
2016/05/19 01:13:54
Now that the test is testing a browser initiated n
Charlie Reis
2016/05/23 22:32:16
I'm confused-- I thought you were making this a te
meacer
2016/05/23 23:57:47
Sorry for the confusion, I decided to only check b
|
| EXPECT_TRUE(process()->sink().GetFirstMessageMatching( |
| FrameMsg_EnableViewSourceMode::ID)); |
| @@ -426,8 +427,8 @@ TEST_F(WebContentsImplTest, NTPViewSource) { |
| ui::PAGE_TRANSITION_TYPED); |
| contents()->GetMainFrame()->PrepareForCommit(); |
| contents()->GetMainFrame()->SendNavigateWithParams(¶ms); |
| - // Also check title and url. |
| - EXPECT_EQ(base::ASCIIToUTF16(kUrl), contents()->GetTitle()); |
| + // Child processes shouldn't be able to load view-source URLs. |
| + EXPECT_EQ(base::ASCIIToUTF16("about:blank"), contents()->GetTitle()); |
|
Charlie Reis
2016/05/16 22:22:18
I'm curious what happened here. Why did it get re
meacer
2016/05/19 01:13:54
As I mentioned in the comment above, view-source:c
|
| } |
| // Test to ensure UpdateMaxPageID is working properly. |