diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-01-04 14:17:57 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-01-05 10:05:06 +0000 |
commit | 39d357e3248f80abea0159765ff39554affb40db (patch) | |
tree | aba0e6bfb76de0244bba0f5fdbd64b830dd6e621 /chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc | |
parent | 87778abf5a1f89266f37d1321b92a21851d8244d (diff) |
BASELINE: Update Chromium to 55.0.2883.105
And updates ninja to 1.7.2
Change-Id: I20d43c737f82764d857ada9a55586901b18b9243
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc')
-rw-r--r-- | chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc | 69 |
1 files changed, 44 insertions, 25 deletions
diff --git a/chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc b/chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc index d45a166f09f..e7dd7eab8b8 100644 --- a/chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc +++ b/chromium/chrome/browser/printing/print_preview_dialog_controller_browsertest.cc @@ -7,8 +7,10 @@ #include <memory> #include "base/bind_helpers.h" +#include "base/files/file_path.h" #include "base/location.h" #include "base/macros.h" +#include "base/memory/ptr_util.h" #include "base/run_loop.h" #include "base/single_thread_task_runner.h" #include "base/strings/utf_string_conversions.h" @@ -16,7 +18,8 @@ #include "build/build_config.h" #include "chrome/browser/plugins/chrome_plugin_service_filter.h" #include "chrome/browser/plugins/plugin_prefs.h" -#include "chrome/browser/task_management/mock_web_contents_task_manager.h" +#include "chrome/browser/profiles/profile.h" +#include "chrome/browser/task_manager/mock_web_contents_task_manager.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_commands.h" #include "chrome/browser/ui/tabs/tab_strip_model.h" @@ -26,6 +29,7 @@ #include "chrome/test/base/in_process_browser_test.h" #include "chrome/test/base/ui_test_utils.h" #include "components/printing/common/print_messages.h" +#include "content/public/browser/browser_accessibility_state.h" #include "content/public/browser/plugin_service.h" #include "content/public/browser/render_frame_host.h" #include "content/public/browser/render_process_host.h" @@ -34,6 +38,7 @@ #include "ipc/ipc_message_macros.h" #include "ui/base/l10n/l10n_util.h" #include "url/gurl.h" +#include "url/origin.h" using content::WebContents; using content::WebContentsObserver; @@ -87,8 +92,8 @@ class PrintPreviewDialogClonedObserver : public WebContentsObserver { // content::WebContentsObserver implementation. void DidCloneToNewWebContents(WebContents* old_web_contents, WebContents* new_web_contents) override { - request_preview_dialog_observer_.reset( - new RequestPrintPreviewObserver(new_web_contents)); + request_preview_dialog_observer_ = + base::MakeUnique<RequestPrintPreviewObserver>(new_web_contents); } std::unique_ptr<RequestPrintPreviewObserver> request_preview_dialog_observer_; @@ -121,6 +126,11 @@ void PluginsLoadedCallback( quit_closure.Run(); } +void PluginEnabledCallback(const base::Closure& quit_closure, bool can_enable) { + EXPECT_TRUE(can_enable); + quit_closure.Run(); +} + bool GetPdfPluginInfo(content::WebPluginInfo* info) { base::FilePath pdf_plugin_path = base::FilePath::FromUTF8Unsafe( ChromeContentClient::kPDFPluginPath); @@ -141,12 +151,8 @@ void CheckPdfPluginForRenderFrame(content::RenderFrameHost* frame) { ChromePluginServiceFilter* filter = ChromePluginServiceFilter::GetInstance(); EXPECT_TRUE(filter->IsPluginAvailable( - frame->GetProcess()->GetID(), - frame->GetRoutingID(), - nullptr, - GURL(kDummyPrintUrl), - GURL(), - &pdf_plugin_info)); + frame->GetProcess()->GetID(), frame->GetRoutingID(), nullptr, + GURL(kDummyPrintUrl), url::Origin(), &pdf_plugin_info)); } } // namespace @@ -184,7 +190,8 @@ class PrintPreviewDialogControllerBrowserTest : public InProcessBrowserTest { // PrintPreviewMessageHandler gets created. Thus enabling // RequestPrintPreviewObserver to get messages first for the purposes of // this test. - cloned_tab_observer_.reset(new PrintPreviewDialogClonedObserver(first_tab)); + cloned_tab_observer_ = + base::MakeUnique<PrintPreviewDialogClonedObserver>(first_tab); chrome::DuplicateTab(browser()); initiator_ = browser()->tab_strip_model()->GetActiveWebContents(); @@ -255,7 +262,7 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, // Reload the initiator. Make sure reloading destroys the print preview // dialog. PrintPreviewDialogDestroyedObserver dialog_destroyed_observer(preview_dialog); - chrome::Reload(browser(), CURRENT_TAB); + chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); content::WaitForLoadStop( browser()->tab_strip_model()->GetActiveWebContents()); ASSERT_TRUE(dialog_destroyed_observer.dialog_destroyed()); @@ -284,8 +291,14 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, ASSERT_TRUE(GetPdfPluginInfo(&pdf_plugin_info)); // Disable the PDF plugin. - PluginPrefs::GetForProfile(browser()->profile())->EnablePluginGroup( - false, base::ASCIIToUTF16(ChromeContentClient::kPDFPluginName)); + { + base::RunLoop run_loop; + PluginPrefs::GetForProfile(browser()->profile())->EnablePlugin( + false, + base::FilePath::FromUTF8Unsafe(ChromeContentClient::kPDFPluginPath), + base::Bind(&PluginEnabledCallback, run_loop.QuitClosure())); + run_loop.Run(); + } // Make sure it is actually disabled for webpages. ChromePluginServiceFilter* filter = ChromePluginServiceFilter::GetInstance(); @@ -293,10 +306,8 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, EXPECT_FALSE(filter->IsPluginAvailable( initiator()->GetRenderProcessHost()->GetID(), initiator()->GetMainFrame()->GetRoutingID(), - nullptr, - GURL("http://google.com"), - GURL(), - &dummy_pdf_plugin_info)); + browser()->profile()->GetResourceContext(), GURL(), + url::Origin(GURL("http://google.com")), &dummy_pdf_plugin_info)); PrintPreview(); @@ -334,9 +345,8 @@ base::string16 GetExpectedPrefix() { base::string16()); } -const std::vector<task_management::WebContentsTag*>& GetTrackedTags() { - return task_management::WebContentsTagsManager::GetInstance()-> - tracked_tags(); +const std::vector<task_manager::WebContentsTag*>& GetTrackedTags() { + return task_manager::WebContentsTagsManager::GetInstance()->tracked_tags(); } IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, @@ -349,12 +359,12 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, // Create a task manager and expect the pre-existing print previews are // provided. - task_management::MockWebContentsTaskManager task_manager; + task_manager::MockWebContentsTaskManager task_manager; EXPECT_TRUE(task_manager.tasks().empty()); task_manager.StartObserving(); ASSERT_EQ(3U, task_manager.tasks().size()); - const task_management::Task* pre_existing_task = task_manager.tasks().back(); - EXPECT_EQ(task_management::Task::RENDERER, pre_existing_task->GetType()); + const task_manager::Task* pre_existing_task = task_manager.tasks().back(); + EXPECT_EQ(task_manager::Task::RENDERER, pre_existing_task->GetType()); const base::string16 pre_existing_title = pre_existing_task->title(); const base::string16 expected_prefix = GetExpectedPrefix(); EXPECT_TRUE(base::StartsWith(pre_existing_title, @@ -373,14 +383,23 @@ IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, PrintPreview(); EXPECT_EQ(3U, GetTrackedTags().size()); ASSERT_EQ(3U, task_manager.tasks().size()); - const task_management::Task* task = task_manager.tasks().back(); - EXPECT_EQ(task_management::Task::RENDERER, task->GetType()); + const task_manager::Task* task = task_manager.tasks().back(); + EXPECT_EQ(task_manager::Task::RENDERER, task->GetType()); const base::string16 title = task->title(); EXPECT_TRUE(base::StartsWith(title, expected_prefix, base::CompareCase::INSENSITIVE_ASCII)); } +IN_PROC_BROWSER_TEST_F(PrintPreviewDialogControllerBrowserTest, + PrintPreviewPdfAccessibility) { + content::BrowserAccessibilityState::GetInstance()->EnableAccessibility(); + ui_test_utils::NavigateToURL(browser(), GURL("data:text/html,HelloWorld")); + PrintPreview(); + WebContents* preview_dialog = GetPrintPreviewDialog(); + WaitForAccessibilityTreeToContainNodeWithName(preview_dialog, "HelloWorld"); +} + } // namespace #endif // defined(ENABLE_TASK_MANAGER) |