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

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

Issue 2525473002: Extending "ChromeSitePerProcessPDFTest.EmbeddedPDFInsideCrossOriginFrame" to verify guest destructi… (Closed)
Patch Set: Addressing alexmos@'s comments Created 4 years 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 // TODO(ekaramad): This test is flaky on Windows 7. Enable it when the issue is 323 // TODO(ekaramad): This test is flaky on Windows 7. Enable it when the issue is
324 // fixed ((https://crbug.com/666379). 324 // fixed ((https://crbug.com/666379).
325 #if defined(OS_WIN) 325 #if defined(OS_WIN)
326 #define MAYBE_EmbeddedPDFInsideCrossOriginFrame \ 326 #define MAYBE_EmbeddedPDFInsideCrossOriginFrame \
327 DISABLED_EmbeddedPDFInsideCrossOriginFrame 327 DISABLED_EmbeddedPDFInsideCrossOriginFrame
328 #else 328 #else
329 #define MAYBE_EmbeddedPDFInsideCrossOriginFrame \ 329 #define MAYBE_EmbeddedPDFInsideCrossOriginFrame \
330 EmbeddedPDFInsideCrossOriginFrame 330 EmbeddedPDFInsideCrossOriginFrame
331 #endif 331 #endif
332 // This test verifies that when navigating an OOPIF to a page with <embed>-ed 332 // This test verifies that when navigating an OOPIF to a page with <embed>-ed
333 // PDF, the guest is properly created (https://crbug.com/649856). 333 // PDF, the guest is properly created, and by removing the embedder frame, the
334 // guest is properly destroyed (https://crbug.com/649856).
334 IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessPDFTest, 335 IN_PROC_BROWSER_TEST_F(ChromeSitePerProcessPDFTest,
335 MAYBE_EmbeddedPDFInsideCrossOriginFrame) { 336 MAYBE_EmbeddedPDFInsideCrossOriginFrame) {
336 // Navigate to a page with an <iframe>. 337 // Navigate to a page with an <iframe>.
337 GURL main_url(embedded_test_server()->GetURL("a.com", "/iframe.html")); 338 GURL main_url(embedded_test_server()->GetURL("a.com", "/iframe.html"));
338 ui_test_utils::NavigateToURL(browser(), main_url); 339 ui_test_utils::NavigateToURL(browser(), main_url);
339 340
340 // Initially, no guests are created. 341 // Initially, no guests are created.
341 EXPECT_EQ(0U, test_guest_view_manager()->num_guests_created()); 342 EXPECT_EQ(0U, test_guest_view_manager()->num_guests_created());
342 343
343 // Navigate subframe to a cross-site page with an embedded PDF. 344 // Navigate subframe to a cross-site page with an embedded PDF.
344 content::WebContents* active_web_contents = 345 content::WebContents* active_web_contents =
345 browser()->tab_strip_model()->GetActiveWebContents(); 346 browser()->tab_strip_model()->GetActiveWebContents();
346 GURL frame_url = 347 GURL frame_url =
347 embedded_test_server()->GetURL("b.com", "/page_with_embedded_pdf.html"); 348 embedded_test_server()->GetURL("b.com", "/page_with_embedded_pdf.html");
348 349
349 // Ensure the page finishes loading without crashing. 350 // Ensure the page finishes loading without crashing.
350 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url)); 351 EXPECT_TRUE(NavigateIframeToURL(active_web_contents, "test", frame_url));
351 352
352 // Wait until the guest for PDF is created. 353 // Wait until the guest for PDF is created.
353 test_guest_view_manager()->WaitForSingleGuestCreated(); 354 content::WebContents* guest_web_contents =
355 test_guest_view_manager()->WaitForSingleGuestCreated();
356
357 // Now detach the frame and observe that the guest is destroyed.
358 content::WebContentsDestroyedWatcher observer(guest_web_contents);
359 EXPECT_TRUE(ExecuteScript(
360 active_web_contents,
361 "document.body.removeChild(document.querySelector('iframe'));"));
362 observer.Wait();
363 EXPECT_EQ(0U, test_guest_view_manager()->GetNumGuestsActive());
354 } 364 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698