| OLD | NEW | 
|---|
| 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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" | 
| 11 #include "base/location.h" | 11 #include "base/location.h" | 
| 12 #include "base/single_thread_task_runner.h" | 12 #include "base/single_thread_task_runner.h" | 
|  | 13 #include "base/strings/pattern.h" | 
| 13 #include "base/strings/stringprintf.h" | 14 #include "base/strings/stringprintf.h" | 
| 14 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" | 
| 15 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" | 
| 16 #include "content/browser/frame_host/cross_process_frame_connector.h" | 17 #include "content/browser/frame_host/cross_process_frame_connector.h" | 
| 17 #include "content/browser/frame_host/frame_tree.h" | 18 #include "content/browser/frame_host/frame_tree.h" | 
| 18 #include "content/browser/frame_host/navigator.h" | 19 #include "content/browser/frame_host/navigator.h" | 
| 19 #include "content/browser/frame_host/render_frame_proxy_host.h" | 20 #include "content/browser/frame_host/render_frame_proxy_host.h" | 
| 20 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 21 #include "content/browser/frame_host/render_widget_host_view_child_frame.h" | 
| 21 #include "content/browser/renderer_host/render_view_host_impl.h" | 22 #include "content/browser/renderer_host/render_view_host_impl.h" | 
| 22 #include "content/browser/web_contents/web_contents_impl.h" | 23 #include "content/browser/web_contents/web_contents_impl.h" | 
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 240 | 241 | 
| 241 bool ConsoleObserverDelegate::AddMessageToConsole( | 242 bool ConsoleObserverDelegate::AddMessageToConsole( | 
| 242     WebContents* source, | 243     WebContents* source, | 
| 243     int32 level, | 244     int32 level, | 
| 244     const base::string16& message, | 245     const base::string16& message, | 
| 245     int32 line_no, | 246     int32 line_no, | 
| 246     const base::string16& source_id) { | 247     const base::string16& source_id) { | 
| 247   DCHECK(source == web_contents_); | 248   DCHECK(source == web_contents_); | 
| 248 | 249 | 
| 249   std::string ascii_message = base::UTF16ToASCII(message); | 250   std::string ascii_message = base::UTF16ToASCII(message); | 
| 250   if (MatchPattern(ascii_message, filter_)) { | 251   if (base::MatchPattern(ascii_message, filter_)) { | 
| 251     message_ = ascii_message; | 252     message_ = ascii_message; | 
| 252     message_loop_runner_->Quit(); | 253     message_loop_runner_->Quit(); | 
| 253   } | 254   } | 
| 254   return false; | 255   return false; | 
| 255 } | 256 } | 
| 256 | 257 | 
| 257 }  // namespace | 258 }  // namespace | 
| 258 | 259 | 
| 259 // | 260 // | 
| 260 // SitePerProcessBrowserTest | 261 // SitePerProcessBrowserTest | 
| (...skipping 2040 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2301   EXPECT_TRUE(ExecuteScript( | 2302   EXPECT_TRUE(ExecuteScript( | 
| 2302       root->child_at(0)->current_frame_host(), | 2303       root->child_at(0)->current_frame_host(), | 
| 2303       "window.domAutomationController.send(" | 2304       "window.domAutomationController.send(" | 
| 2304       "    parent.frames['frame2'].location.href = 'data:text/html,foo');")); | 2305       "    parent.frames['frame2'].location.href = 'data:text/html,foo');")); | 
| 2305   console_delegate->Wait(); | 2306   console_delegate->Wait(); | 
| 2306 | 2307 | 
| 2307   std::string frame_origin = | 2308   std::string frame_origin = | 
| 2308       root->child_at(1)->current_replication_state().origin.string(); | 2309       root->child_at(1)->current_replication_state().origin.string(); | 
| 2309   EXPECT_EQ(frame_origin + "/", frame_url.GetOrigin().spec()); | 2310   EXPECT_EQ(frame_origin + "/", frame_url.GetOrigin().spec()); | 
| 2310   EXPECT_TRUE( | 2311   EXPECT_TRUE( | 
| 2311       MatchPattern(console_delegate->message(), "*" + frame_origin + "*")) | 2312       base::MatchPattern(console_delegate->message(), "*" + frame_origin + "*")) | 
| 2312       << "Error message does not contain the frame's latest origin (" | 2313       << "Error message does not contain the frame's latest origin (" | 
| 2313       << frame_origin << ")"; | 2314       << frame_origin << ")"; | 
| 2314 } | 2315 } | 
| 2315 | 2316 | 
| 2316 // Ensure that navigating subframes in --site-per-process mode properly fires | 2317 // Ensure that navigating subframes in --site-per-process mode properly fires | 
| 2317 // the DidStopLoading event on WebContentsObserver. | 2318 // the DidStopLoading event on WebContentsObserver. | 
| 2318 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteDidStopLoading) { | 2319 IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, CrossSiteDidStopLoading) { | 
| 2319   GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 2320   GURL main_url(embedded_test_server()->GetURL("/site_per_process_main.html")); | 
| 2320   NavigateToURL(shell(), main_url); | 2321   NavigateToURL(shell(), main_url); | 
| 2321 | 2322 | 
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2689       "   |--Site A\n" | 2690       "   |--Site A\n" | 
| 2690       "   +--Site A\n" | 2691       "   +--Site A\n" | 
| 2691       "        |--Site A\n" | 2692       "        |--Site A\n" | 
| 2692       "        +--Site A\n" | 2693       "        +--Site A\n" | 
| 2693       "             +--Site A\n" | 2694       "             +--Site A\n" | 
| 2694       "Where A = http://127.0.0.1/", | 2695       "Where A = http://127.0.0.1/", | 
| 2695       DepictFrameTree(root)); | 2696       DepictFrameTree(root)); | 
| 2696 } | 2697 } | 
| 2697 | 2698 | 
| 2698 }  // namespace content | 2699 }  // namespace content | 
| OLD | NEW | 
|---|