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

Side by Side Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 1350073002: PDFs viewed inside a <webview> should navigate the same as PDFs in tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Pass boolean instead of tabId. Created 5 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf.js » ('j') | chrome/browser/resources/pdf/pdf.js » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <queue> 5 #include <queue>
6 6
7 #include "base/location.h" 7 #include "base/location.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/process/process.h" 9 #include "base/process/process.h"
10 #include "base/single_thread_task_runner.h" 10 #include "base/single_thread_task_runner.h"
(...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after
1618 GetGuestWebContents()->GetDelegate()->OpenURLFromTab( 1618 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(
1619 GetGuestWebContents(), params); 1619 GetGuestWebContents(), params);
1620 1620
1621 ASSERT_TRUE(load_listener.WaitUntilSatisfied()); 1621 ASSERT_TRUE(load_listener.WaitUntilSatisfied());
1622 1622
1623 // Verify that the <webview> ends up at about:blank. 1623 // Verify that the <webview> ends up at about:blank.
1624 EXPECT_EQ(GURL(url::kAboutBlankURL), 1624 EXPECT_EQ(GURL(url::kAboutBlankURL),
1625 GetGuestWebContents()->GetLastCommittedURL()); 1625 GetGuestWebContents()->GetLastCommittedURL());
1626 } 1626 }
1627 1627
1628 // A navigation to a web-safe URL should succeed, even if it is not renderer-
1629 // initiated, such as a navigation from the PDF viewer.
1630 IN_PROC_BROWSER_TEST_F(WebViewTest, OpenURLFromTab_CurrentTab_Succeed) {
1631 LoadAppWithGuest("web_view/simple");
1632
1633 // Verify that OpenURLFromTab with a window disposition of CURRENT_TAB will
1634 // navigate the current <webview>.
1635 ExtensionTestMessageListener load_listener("WebViewTest.LOADSTOP", false);
1636
1637 GURL test_url("http://www.google.com");
1638 content::OpenURLParams params(test_url, content::Referrer(), CURRENT_TAB,
1639 ui::PAGE_TRANSITION_AUTO_TOPLEVEL,
1640 false /* is_renderer_initiated */);
1641 GetGuestWebContents()->GetDelegate()->OpenURLFromTab(GetGuestWebContents(),
1642 params);
1643
1644 ASSERT_TRUE(load_listener.WaitUntilSatisfied());
1645
1646 EXPECT_EQ(test_url, GetGuestWebContents()->GetLastCommittedURL());
1647 }
1648
1628 IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) { 1649 IN_PROC_BROWSER_TEST_F(WebViewNewWindowTest, OpenURLFromTab_NewWindow_Abort) {
1629 LoadAppWithGuest("web_view/simple"); 1650 LoadAppWithGuest("web_view/simple");
1630 1651
1631 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB 1652 // Verify that OpenURLFromTab with a window disposition of NEW_BACKGROUND_TAB
1632 // will trigger the <webview>'s New Window API. 1653 // will trigger the <webview>'s New Window API.
1633 ExtensionTestMessageListener new_window_listener( 1654 ExtensionTestMessageListener new_window_listener(
1634 "WebViewTest.NEWWINDOW", false); 1655 "WebViewTest.NEWWINDOW", false);
1635 1656
1636 // Navigating to a file URL is forbidden inside a <webview>. 1657 // Navigating to a file URL is forbidden inside a <webview>.
1637 content::OpenURLParams params(GURL("file://foo"), 1658 content::OpenURLParams params(GURL("file://foo"),
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2918 const task_management::Task* task = task_manager.tasks().back(); 2939 const task_management::Task* task = task_manager.tasks().back();
2919 EXPECT_EQ(task_management::Task::GUEST, task->GetType()); 2940 EXPECT_EQ(task_management::Task::GUEST, task->GetType());
2920 const base::string16 title = task->title(); 2941 const base::string16 title = task->title();
2921 const base::string16 expected_prefix = GetExpectedPrefix(guest_contents); 2942 const base::string16 expected_prefix = GetExpectedPrefix(guest_contents);
2922 EXPECT_TRUE(base::StartsWith(title, 2943 EXPECT_TRUE(base::StartsWith(title,
2923 expected_prefix, 2944 expected_prefix,
2924 base::CompareCase::INSENSITIVE_ASCII)); 2945 base::CompareCase::INSENSITIVE_ASCII));
2925 } 2946 }
2926 2947
2927 #endif // defined(ENABLE_TASK_MANAGER) 2948 #endif // defined(ENABLE_TASK_MANAGER)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/pdf/pdf.js » ('j') | chrome/browser/resources/pdf/pdf.js » ('J')

Powered by Google App Engine
This is Rietveld 408576698