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

Side by Side Diff: content/public/test/content_browser_test_utils.cc

Issue 248963007: Perform navigation policy check on UI thread for --site-per-process. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changes based on Charlie's review. Created 6 years, 8 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 | Annotate | Revision Log
OLDNEW
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/public/test/content_browser_test_utils.h" 5 #include "content/public/test/content_browser_test_utils.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
11 #include "content/browser/frame_host/frame_tree_node.h"
12 #include "content/browser/frame_host/navigator.h"
11 #include "content/public/browser/navigation_controller.h" 13 #include "content/public/browser/navigation_controller.h"
12 #include "content/public/browser/notification_source.h" 14 #include "content/public/browser/notification_source.h"
13 #include "content/public/browser/web_contents.h" 15 #include "content/public/browser/web_contents.h"
14 #include "content/public/common/content_paths.h" 16 #include "content/public/common/content_paths.h"
15 #include "content/public/test/browser_test_utils.h" 17 #include "content/public/test/browser_test_utils.h"
16 #include "content/public/test/test_navigation_observer.h" 18 #include "content/public/test/test_navigation_observer.h"
17 #include "content/public/test/test_utils.h" 19 #include "content/public/test/test_utils.h"
18 #include "content/shell/browser/shell.h" 20 #include "content/shell/browser/shell.h"
19 #include "content/shell/browser/shell_javascript_dialog_manager.h" 21 #include "content/shell/browser/shell_javascript_dialog_manager.h"
22 #include "content/test/test_frame_navigation_observer.h"
20 #include "net/base/filename_util.h" 23 #include "net/base/filename_util.h"
21 24
22 namespace content { 25 namespace content {
23 26
24 base::FilePath GetTestFilePath(const char* dir, const char* file) { 27 base::FilePath GetTestFilePath(const char* dir, const char* file) {
25 base::FilePath path; 28 base::FilePath path;
26 PathService::Get(DIR_TEST_DATA, &path); 29 PathService::Get(DIR_TEST_DATA, &path);
27 return path.Append(base::FilePath().AppendASCII(dir).Append( 30 return path.Append(base::FilePath().AppendASCII(dir).Append(
28 base::FilePath().AppendASCII(file))); 31 base::FilePath().AppendASCII(file)));
29 } 32 }
(...skipping 19 matching lines...) Expand all
49 TestNavigationObserver same_tab_observer(window->web_contents(), 1); 52 TestNavigationObserver same_tab_observer(window->web_contents(), 1);
50 53
51 window->LoadDataWithBaseURL(url, data, base_url); 54 window->LoadDataWithBaseURL(url, data, base_url);
52 same_tab_observer.Wait(); 55 same_tab_observer.Wait();
53 } 56 }
54 57
55 void NavigateToURL(Shell* window, const GURL& url) { 58 void NavigateToURL(Shell* window, const GURL& url) {
56 NavigateToURLBlockUntilNavigationsComplete(window, url, 1); 59 NavigateToURLBlockUntilNavigationsComplete(window, url, 1);
57 } 60 }
58 61
62 void NavigateFrameToURL(FrameTreeNode* node, const GURL& url) {
63 TestFrameNavigationObserver observer(node);
64 NavigationController::LoadURLParams params(url);
65 params.transition_type = PageTransitionFromInt(PAGE_TRANSITION_LINK);
66 params.frame_tree_node_id = node->frame_tree_node_id();
67 node->navigator()->GetController()->LoadURLWithParams(params);
68 observer.Wait();
69 }
70
59 void WaitForAppModalDialog(Shell* window) { 71 void WaitForAppModalDialog(Shell* window) {
60 ShellJavaScriptDialogManager* dialog_manager= 72 ShellJavaScriptDialogManager* dialog_manager=
61 static_cast<ShellJavaScriptDialogManager*>( 73 static_cast<ShellJavaScriptDialogManager*>(
62 window->GetJavaScriptDialogManager()); 74 window->GetJavaScriptDialogManager());
63 75
64 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner(); 76 scoped_refptr<MessageLoopRunner> runner = new MessageLoopRunner();
65 dialog_manager->set_dialog_request_callback(runner->QuitClosure()); 77 dialog_manager->set_dialog_request_callback(runner->QuitClosure());
66 runner->Run(); 78 runner->Run();
67 } 79 }
68 80
(...skipping 16 matching lines...) Expand all
85 } 97 }
86 98
87 void ShellAddedObserver::ShellCreated(Shell* shell) { 99 void ShellAddedObserver::ShellCreated(Shell* shell) {
88 DCHECK(!shell_); 100 DCHECK(!shell_);
89 shell_ = shell; 101 shell_ = shell;
90 if (runner_.get()) 102 if (runner_.get())
91 runner_->QuitClosure().Run(); 103 runner_->QuitClosure().Run();
92 } 104 }
93 105
94 } // namespace content 106 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698