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

Side by Side Diff: chrome/browser/tab_contents/view_source_browsertest.cc

Issue 10535088: TabContentsWrapper -> TabContents, part 30. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/utf_string_conversions.h" 5 #include "base/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/common/url_constants.h" 8 #include "chrome/common/url_constants.h"
9 #include "chrome/test/base/in_process_browser_test.h" 9 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 10 #include "chrome/test/base/ui_test_utils.h"
(...skipping 15 matching lines...) Expand all
26 ASSERT_TRUE(test_server()->Start()); 26 ASSERT_TRUE(test_server()->Start());
27 27
28 // First we navigate to our view-source test page. 28 // First we navigate to our view-source test page.
29 GURL url(chrome::kViewSourceScheme + std::string(":") + 29 GURL url(chrome::kViewSourceScheme + std::string(":") +
30 test_server()->GetURL(kTestHtml).spec()); 30 test_server()->GetURL(kTestHtml).spec());
31 ui_test_utils::NavigateToURL(browser(), url); 31 ui_test_utils::NavigateToURL(browser(), url);
32 32
33 // Check that the title didn't get set. It should not be there (because we 33 // Check that the title didn't get set. It should not be there (because we
34 // are in view-source mode). 34 // are in view-source mode).
35 EXPECT_NE(ASCIIToUTF16("foo"), 35 EXPECT_NE(ASCIIToUTF16("foo"),
36 browser()->GetSelectedWebContents()->GetTitle()); 36 browser()->GetActiveWebContents()->GetTitle());
37 } 37 }
38 38
39 // This test renders a page normally and then renders the same page in 39 // This test renders a page normally and then renders the same page in
40 // view-source mode. This is done since we had a problem at one point during 40 // view-source mode. This is done since we had a problem at one point during
41 // implementation of the view-source: prefix being consumed (removed from the 41 // implementation of the view-source: prefix being consumed (removed from the
42 // URL) if the URL was not changed (apart from adding the view-source prefix) 42 // URL) if the URL was not changed (apart from adding the view-source prefix)
43 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) { 43 IN_PROC_BROWSER_TEST_F(ViewSourceTest, DoesBrowserConsumeViewSourcePrefix) {
44 ASSERT_TRUE(test_server()->Start()); 44 ASSERT_TRUE(test_server()->Start());
45 45
46 // First we navigate to google.html. 46 // First we navigate to google.html.
47 GURL url(test_server()->GetURL(kTestHtml)); 47 GURL url(test_server()->GetURL(kTestHtml));
48 ui_test_utils::NavigateToURL(browser(), url); 48 ui_test_utils::NavigateToURL(browser(), url);
49 49
50 // Then we navigate to the same url but with the "view-source:" prefix. 50 // Then we navigate to the same url but with the "view-source:" prefix.
51 GURL url_viewsource(chrome::kViewSourceScheme + std::string(":") + 51 GURL url_viewsource(chrome::kViewSourceScheme + std::string(":") +
52 url.spec()); 52 url.spec());
53 ui_test_utils::NavigateToURL(browser(), url_viewsource); 53 ui_test_utils::NavigateToURL(browser(), url_viewsource);
54 54
55 // The URL should still be prefixed with "view-source:". 55 // The URL should still be prefixed with "view-source:".
56 EXPECT_EQ(url_viewsource.spec(), 56 EXPECT_EQ(url_viewsource.spec(),
57 browser()->GetSelectedWebContents()->GetURL().spec()); 57 browser()->GetActiveWebContents()->GetURL().spec());
58 } 58 }
59 59
60 // Make sure that when looking at the actual page, we can select "View Source" 60 // Make sure that when looking at the actual page, we can select "View Source"
61 // from the menu. 61 // from the menu.
62 IN_PROC_BROWSER_TEST_F(ViewSourceTest, ViewSourceInMenuEnabledOnANormalPage) { 62 IN_PROC_BROWSER_TEST_F(ViewSourceTest, ViewSourceInMenuEnabledOnANormalPage) {
63 ASSERT_TRUE(test_server()->Start()); 63 ASSERT_TRUE(test_server()->Start());
64 64
65 GURL url(test_server()->GetURL(kTestHtml)); 65 GURL url(test_server()->GetURL(kTestHtml));
66 ui_test_utils::NavigateToURL(browser(), url); 66 ui_test_utils::NavigateToURL(browser(), url);
67 67
68 EXPECT_TRUE(browser()->command_updater()->IsCommandEnabled(IDC_VIEW_SOURCE)); 68 EXPECT_TRUE(browser()->command_updater()->IsCommandEnabled(IDC_VIEW_SOURCE));
69 } 69 }
70 70
71 // Make sure that when looking at the page source, we can't select "View Source" 71 // Make sure that when looking at the page source, we can't select "View Source"
72 // from the menu. 72 // from the menu.
73 // 73 //
74 // Occasionally crashes on all platforms, see http://crbug.com/69249 74 // Occasionally crashes on all platforms, see http://crbug.com/69249
75 IN_PROC_BROWSER_TEST_F(ViewSourceTest, 75 IN_PROC_BROWSER_TEST_F(ViewSourceTest,
76 ViewSourceInMenuDisabledWhileViewingSource) { 76 ViewSourceInMenuDisabledWhileViewingSource) {
77 ASSERT_TRUE(test_server()->Start()); 77 ASSERT_TRUE(test_server()->Start());
78 78
79 GURL url_viewsource(chrome::kViewSourceScheme + std::string(":") + 79 GURL url_viewsource(chrome::kViewSourceScheme + std::string(":") +
80 test_server()->GetURL(kTestHtml).spec()); 80 test_server()->GetURL(kTestHtml).spec());
81 ui_test_utils::NavigateToURL(browser(), url_viewsource); 81 ui_test_utils::NavigateToURL(browser(), url_viewsource);
82 82
83 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_VIEW_SOURCE)); 83 EXPECT_FALSE(browser()->command_updater()->IsCommandEnabled(IDC_VIEW_SOURCE));
84 } 84 }
OLDNEW
« no previous file with comments | « chrome/browser/tab_contents/tab_contents_ssl_helper.cc ('k') | chrome/browser/tab_contents/web_drag_bookmark_handler_aura.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698