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

Side by Side Diff: chrome/browser/chrome_find_request_manager_browsertest.cc

Issue 2700613003: Enable find-in-page across GuestViews. (Closed)
Patch Set: Created 3 years, 9 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/pdf/pdf_extension_test_util.h" 7 #include "chrome/browser/pdf/pdf_extension_test_util.h"
8 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/tabs/tab_strip_model.h" 9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/test/base/in_process_browser_test.h" 10 #include "chrome/test/base/in_process_browser_test.h"
11 #include "chrome/test/base/ui_test_utils.h" 11 #include "chrome/test/base/ui_test_utils.h"
12 #include "content/public/browser/browser_context.h"
13 #include "content/public/browser/browser_plugin_guest_manager.h"
12 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
13 #include "content/public/test/browser_test_utils.h" 15 #include "content/public/test/browser_test_utils.h"
14 #include "content/public/test/find_test_utils.h" 16 #include "content/public/test/find_test_utils.h"
15 #include "content/public/test/test_navigation_observer.h" 17 #include "content/public/test/test_navigation_observer.h"
16 #include "net/dns/mock_host_resolver.h" 18 #include "net/dns/mock_host_resolver.h"
17 #include "third_party/WebKit/public/web/WebFindOptions.h" 19 #include "third_party/WebKit/public/web/WebFindOptions.h"
18 20
19 namespace content { 21 namespace content {
20 22
21 class ChromeFindRequestManagerTest : public InProcessBrowserTest { 23 class ChromeFindRequestManagerTest : public InProcessBrowserTest {
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 // The ID of the last find request requested. 78 // The ID of the last find request requested.
77 int last_request_id_; 79 int last_request_id_;
78 80
79 DISALLOW_COPY_AND_ASSIGN(ChromeFindRequestManagerTest); 81 DISALLOW_COPY_AND_ASSIGN(ChromeFindRequestManagerTest);
80 }; 82 };
81 83
82 84
83 // Tests searching in a full-page PDF. 85 // Tests searching in a full-page PDF.
84 IN_PROC_BROWSER_TEST_F(ChromeFindRequestManagerTest, FindInPDF) { 86 IN_PROC_BROWSER_TEST_F(ChromeFindRequestManagerTest, FindInPDF) {
85 LoadAndWait("/find_in_pdf_page.pdf"); 87 LoadAndWait("/find_in_pdf_page.pdf");
86 pdf_extension_test_util::EnsurePDFHasLoaded(contents()); 88 ASSERT_TRUE(pdf_extension_test_util::EnsurePDFHasLoaded(contents()));
87 89
88 blink::WebFindOptions options; 90 blink::WebFindOptions options;
89 Find("result", options); 91 Find("result", options);
90 options.findNext = true; 92 options.findNext = true;
91 Find("result", options); 93 Find("result", options);
92 Find("result", options); 94 Find("result", options);
93 delegate()->WaitForFinalReply(); 95 delegate()->WaitForFinalReply();
94 96
95 FindResults results = delegate()->GetFindResults(); 97 FindResults results = delegate()->GetFindResults();
96 EXPECT_EQ(last_request_id(), results.request_id); 98 EXPECT_EQ(last_request_id(), results.request_id);
97 EXPECT_EQ(5, results.number_of_matches); 99 EXPECT_EQ(5, results.number_of_matches);
98 EXPECT_EQ(3, results.active_match_ordinal); 100 EXPECT_EQ(3, results.active_match_ordinal);
99 } 101 }
100 102
103 // Tests searching in a page with embedded PDFs. Note that this test, the
104 // FindInPDF test, and the find tests in web_view_browsertest.cc ensure that
105 // find-in-page works across GuestViews.
106 //
107 // TODO(paulmeyer): Note that this is left disabled for now since
108 // EnsurePDFHasLoaded() currently does not work for embedded PDFs. This will be
109 // fixed and enabled in a subsequent patch.
110 IN_PROC_BROWSER_TEST_F(ChromeFindRequestManagerTest,
111 DISABLED_FindInEmbeddedPDFs) {
112 LoadAndWait("/find_in_embedded_pdf_page.html");
113 ASSERT_TRUE(pdf_extension_test_util::EnsurePDFHasLoaded(contents()));
114
115 blink::WebFindOptions options;
116 Find("result", options);
117 options.findNext = true;
118 options.forward = false;
119 Find("result", options);
120 Find("result", options);
121 Find("result", options);
122 delegate()->WaitForFinalReply();
123
124 FindResults results = delegate()->GetFindResults();
125 EXPECT_EQ(last_request_id(), results.request_id);
126 EXPECT_EQ(13, results.number_of_matches);
127 EXPECT_EQ(11, results.active_match_ordinal);
128 }
129
101 } // namespace content 130 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698