| OLD | NEW |
| 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 "base/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/app/chrome_command_ids.h" | 6 #include "chrome/app/chrome_command_ids.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) { | 33 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserRenderInViewSource) { |
| 34 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 34 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 35 | 35 |
| 36 // First we navigate to our view-source test page. | 36 // First we navigate to our view-source test page. |
| 37 GURL url(content::kViewSourceScheme + std::string(":") + | 37 GURL url(content::kViewSourceScheme + std::string(":") + |
| 38 embedded_test_server()->GetURL(kTestHtml).spec()); | 38 embedded_test_server()->GetURL(kTestHtml).spec()); |
| 39 ui_test_utils::NavigateToURL(browser(), url); | 39 ui_test_utils::NavigateToURL(browser(), url); |
| 40 | 40 |
| 41 // Check that the title didn't get set. It should not be there (because we | 41 // Check that the title didn't get set. It should not be there (because we |
| 42 // are in view-source mode). | 42 // are in view-source mode). |
| 43 EXPECT_NE(ASCIIToUTF16("foo"), | 43 EXPECT_NE(base::ASCIIToUTF16("foo"), |
| 44 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); | 44 browser()->tab_strip_model()->GetActiveWebContents()->GetTitle()); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // This test renders a page normally and then renders the same page in | 47 // This test renders a page normally and then renders the same page in |
| 48 // view-source mode. This is done since we had a problem at one point during | 48 // view-source mode. This is done since we had a problem at one point during |
| 49 // implementation of the view-source: prefix being consumed (removed from the | 49 // implementation of the view-source: prefix being consumed (removed from the |
| 50 // URL) if the URL was not changed (apart from adding the view-source prefix) | 50 // URL) if the URL was not changed (apart from adding the view-source prefix) |
| 51 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) { | 51 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) { |
| 52 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 52 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 53 | 53 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 content::ExecuteScript(browser()->tab_strip_model()->GetWebContentsAt(0), | 124 content::ExecuteScript(browser()->tab_strip_model()->GetWebContentsAt(0), |
| 125 "window.location.reload();")); | 125 "window.location.reload();")); |
| 126 | 126 |
| 127 content::WindowedNotificationObserver observer2( | 127 content::WindowedNotificationObserver observer2( |
| 128 content::NOTIFICATION_LOAD_STOP, | 128 content::NOTIFICATION_LOAD_STOP, |
| 129 content::NotificationService::AllSources()); | 129 content::NotificationService::AllSources()); |
| 130 observer2.Wait(); | 130 observer2.Wait(); |
| 131 ASSERT_TRUE(browser()->tab_strip_model()->GetWebContentsAt(0)-> | 131 ASSERT_TRUE(browser()->tab_strip_model()->GetWebContentsAt(0)-> |
| 132 GetController().GetActiveEntry()->IsViewSourceMode()); | 132 GetController().GetActiveEntry()->IsViewSourceMode()); |
| 133 } | 133 } |
| OLD | NEW |