| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // Switch back to the first tab and navigate it cross-process. | 161 // Switch back to the first tab and navigate it cross-process. |
| 162 browser()->tab_strip_model()->ActivateTabAt(0, true); | 162 browser()->tab_strip_model()->ActivateTabAt(0, true); |
| 163 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIVersionURL)); | 163 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIVersionURL)); |
| 164 EXPECT_TRUE(chrome::CanViewSource(browser())); | 164 EXPECT_TRUE(chrome::CanViewSource(browser())); |
| 165 | 165 |
| 166 // Navigate back in session history to ensure view-source mode is still | 166 // Navigate back in session history to ensure view-source mode is still |
| 167 // active. | 167 // active. |
| 168 { | 168 { |
| 169 ui_test_utils::UrlLoadObserver load_complete( | 169 ui_test_utils::UrlLoadObserver load_complete( |
| 170 url_viewsource, content::NotificationService::AllSources()); | 170 url_viewsource, content::NotificationService::AllSources()); |
| 171 chrome::GoBack(browser(), CURRENT_TAB); | 171 chrome::GoBack(browser(), WindowOpenDisposition::CURRENT_TAB); |
| 172 load_complete.Wait(); | 172 load_complete.Wait(); |
| 173 } | 173 } |
| 174 | 174 |
| 175 // Check whether the page is in view-source mode or not by checking if an | 175 // Check whether the page is in view-source mode or not by checking if an |
| 176 // expected element on the page exists or not. In view-source mode it | 176 // expected element on the page exists or not. In view-source mode it |
| 177 // should not be found. | 177 // should not be found. |
| 178 bool result = false; | 178 bool result = false; |
| 179 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( | 179 EXPECT_TRUE(content::ExecuteScriptAndExtractBool( |
| 180 browser()->tab_strip_model()->GetActiveWebContents(), | 180 browser()->tab_strip_model()->GetActiveWebContents(), |
| 181 "domAutomationController.send(document.getElementById('bar') === null);", | 181 "domAutomationController.send(document.getElementById('bar') === null);", |
| 182 &result)); | 182 &result)); |
| 183 EXPECT_TRUE(result); | 183 EXPECT_TRUE(result); |
| 184 EXPECT_FALSE(chrome::CanViewSource(browser())); | 184 EXPECT_FALSE(chrome::CanViewSource(browser())); |
| 185 } | 185 } |
| OLD | NEW |