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

Side by Side Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 467653002: Revert of [DevTools] Make DevTools clients talk directly to DevToolsAgentHost instead of using DevToolsManage… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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
« no previous file with comments | « chrome/browser/extensions/api/debugger/debugger_api.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <deque> 5 #include <deque>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 #include "chrome/common/chrome_switches.h" 60 #include "chrome/common/chrome_switches.h"
61 #include "chrome/common/extensions/extension_constants.h" 61 #include "chrome/common/extensions/extension_constants.h"
62 #include "chrome/common/extensions/manifest_handlers/mime_types_handler.h" 62 #include "chrome/common/extensions/manifest_handlers/mime_types_handler.h"
63 #include "chrome/common/pref_names.h" 63 #include "chrome/common/pref_names.h"
64 #include "chrome/test/base/in_process_browser_test.h" 64 #include "chrome/test/base/in_process_browser_test.h"
65 #include "chrome/test/base/test_switches.h" 65 #include "chrome/test/base/test_switches.h"
66 #include "chrome/test/base/ui_test_utils.h" 66 #include "chrome/test/base/ui_test_utils.h"
67 #include "chrome/test/base/uma_histogram_helper.h" 67 #include "chrome/test/base/uma_histogram_helper.h"
68 #include "content/public/browser/browser_message_filter.h" 68 #include "content/public/browser/browser_message_filter.h"
69 #include "content/public/browser/devtools_agent_host.h" 69 #include "content/public/browser/devtools_agent_host.h"
70 #include "content/public/browser/devtools_client_host.h"
71 #include "content/public/browser/devtools_manager.h"
70 #include "content/public/browser/navigation_controller.h" 72 #include "content/public/browser/navigation_controller.h"
71 #include "content/public/browser/navigation_entry.h" 73 #include "content/public/browser/navigation_entry.h"
72 #include "content/public/browser/notification_service.h" 74 #include "content/public/browser/notification_service.h"
73 #include "content/public/browser/render_frame_host.h" 75 #include "content/public/browser/render_frame_host.h"
74 #include "content/public/browser/render_process_host.h" 76 #include "content/public/browser/render_process_host.h"
75 #include "content/public/browser/render_view_host.h" 77 #include "content/public/browser/render_view_host.h"
76 #include "content/public/browser/site_instance.h" 78 #include "content/public/browser/site_instance.h"
77 #include "content/public/browser/web_contents.h" 79 #include "content/public/browser/web_contents.h"
78 #include "content/public/browser/web_contents_observer.h" 80 #include "content/public/browser/web_contents_observer.h"
79 #include "content/public/common/url_constants.h" 81 #include "content/public/common/url_constants.h"
(...skipping 11 matching lines...) Expand all
91 #include "net/url_request/url_request_context.h" 93 #include "net/url_request/url_request_context.h"
92 #include "net/url_request/url_request_context_getter.h" 94 #include "net/url_request/url_request_context_getter.h"
93 #include "net/url_request/url_request_filter.h" 95 #include "net/url_request/url_request_filter.h"
94 #include "net/url_request/url_request_interceptor.h" 96 #include "net/url_request/url_request_interceptor.h"
95 #include "net/url_request/url_request_job.h" 97 #include "net/url_request/url_request_job.h"
96 #include "ui/base/l10n/l10n_util.h" 98 #include "ui/base/l10n/l10n_util.h"
97 #include "url/gurl.h" 99 #include "url/gurl.h"
98 100
99 using content::BrowserThread; 101 using content::BrowserThread;
100 using content::DevToolsAgentHost; 102 using content::DevToolsAgentHost;
103 using content::DevToolsClientHost;
104 using content::DevToolsManager;
101 using content::NavigationController; 105 using content::NavigationController;
102 using content::OpenURLParams; 106 using content::OpenURLParams;
103 using content::Referrer; 107 using content::Referrer;
104 using content::RenderFrameHost; 108 using content::RenderFrameHost;
105 using content::RenderViewHost; 109 using content::RenderViewHost;
106 using content::RenderWidgetHost; 110 using content::RenderWidgetHost;
107 using content::TestNavigationObserver; 111 using content::TestNavigationObserver;
108 using content::WebContents; 112 using content::WebContents;
109 using content::WebContentsObserver; 113 using content::WebContentsObserver;
110 using task_manager::browsertest_util::WaitForTaskManagerRows; 114 using task_manager::browsertest_util::WaitForTaskManagerRows;
(...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 739
736 FakeSafeBrowsingService* most_recent_service() const { 740 FakeSafeBrowsingService* most_recent_service() const {
737 return most_recent_service_; 741 return most_recent_service_;
738 } 742 }
739 743
740 private: 744 private:
741 FakeSafeBrowsingService* most_recent_service_; 745 FakeSafeBrowsingService* most_recent_service_;
742 }; 746 };
743 #endif 747 #endif
744 748
745 class FakeDevToolsClient : public content::DevToolsAgentHostClient { 749 class FakeDevToolsClientHost : public DevToolsClientHost {
746 public: 750 public:
747 FakeDevToolsClient() {} 751 FakeDevToolsClientHost() {}
748 virtual ~FakeDevToolsClient() {} 752 virtual ~FakeDevToolsClientHost() {}
749 virtual void DispatchProtocolMessage( 753 virtual void InspectedContentsClosing() OVERRIDE {}
750 DevToolsAgentHost* agent_host, const std::string& message) OVERRIDE {} 754 virtual void DispatchOnInspectorFrontend(const std::string& msg) OVERRIDE {}
751 virtual void AgentHostClosed( 755 virtual void ReplacedWithAnotherClient() OVERRIDE {}
752 DevToolsAgentHost* agent_host, bool replaced) OVERRIDE {}
753 }; 756 };
754 757
755 class RestorePrerenderMode { 758 class RestorePrerenderMode {
756 public: 759 public:
757 RestorePrerenderMode() : prev_mode_(PrerenderManager::GetMode()) { 760 RestorePrerenderMode() : prev_mode_(PrerenderManager::GetMode()) {
758 } 761 }
759 762
760 ~RestorePrerenderMode() { PrerenderManager::SetMode(prev_mode_); } 763 ~RestorePrerenderMode() { PrerenderManager::SetMode(prev_mode_); }
761 private: 764 private:
762 PrerenderManager::PrerenderManagerMode prev_mode_; 765 PrerenderManager::PrerenderManagerMode prev_mode_;
(...skipping 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after
3287 OpenDestURLViaClickNewBackgroundTab(); 3290 OpenDestURLViaClickNewBackgroundTab();
3288 } 3291 }
3289 3292
3290 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, 3293 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest,
3291 NavigateToPrerenderedPageWhenDevToolsAttached) { 3294 NavigateToPrerenderedPageWhenDevToolsAttached) {
3292 DisableJavascriptCalls(); 3295 DisableJavascriptCalls();
3293 WebContents* web_contents = 3296 WebContents* web_contents =
3294 current_browser()->tab_strip_model()->GetActiveWebContents(); 3297 current_browser()->tab_strip_model()->GetActiveWebContents();
3295 scoped_refptr<DevToolsAgentHost> agent( 3298 scoped_refptr<DevToolsAgentHost> agent(
3296 DevToolsAgentHost::GetOrCreateFor(web_contents)); 3299 DevToolsAgentHost::GetOrCreateFor(web_contents));
3297 FakeDevToolsClient client; 3300 DevToolsManager* manager = DevToolsManager::GetInstance();
3298 agent->AttachClient(&client); 3301 FakeDevToolsClientHost client_host;
3302 manager->RegisterDevToolsClientHostFor(agent.get(), &client_host);
3299 const char* url = "files/prerender/prerender_page.html"; 3303 const char* url = "files/prerender/prerender_page.html";
3300 PrerenderTestURL(url, FINAL_STATUS_DEVTOOLS_ATTACHED, 1); 3304 PrerenderTestURL(url, FINAL_STATUS_DEVTOOLS_ATTACHED, 1);
3301 NavigateToURLWithDisposition(url, CURRENT_TAB, false); 3305 NavigateToURLWithDisposition(url, CURRENT_TAB, false);
3302 agent->DetachClient(); 3306 manager->ClientHostClosing(&client_host);
3303 } 3307 }
3304 3308
3305 // Validate that the sessionStorage namespace remains the same when swapping 3309 // Validate that the sessionStorage namespace remains the same when swapping
3306 // in a prerendered page. 3310 // in a prerendered page.
3307 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSessionStorage) { 3311 IN_PROC_BROWSER_TEST_F(PrerenderBrowserTest, PrerenderSessionStorage) {
3308 set_loader_path("files/prerender/prerender_loader_with_session_storage.html"); 3312 set_loader_path("files/prerender/prerender_loader_with_session_storage.html");
3309 PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"), 3313 PrerenderTestURL(GetCrossDomainTestUrl("files/prerender/prerender_page.html"),
3310 FINAL_STATUS_USED, 3314 FINAL_STATUS_USED,
3311 1); 3315 1);
3312 NavigateToDestURL(); 3316 NavigateToDestURL();
(...skipping 1102 matching lines...) Expand 10 before | Expand all | Expand 10 after
4415 4419
4416 // Navigate to the URL entered. 4420 // Navigate to the URL entered.
4417 omnibox_view->model()->AcceptInput(CURRENT_TAB, false); 4421 omnibox_view->model()->AcceptInput(CURRENT_TAB, false);
4418 4422
4419 // Prerender should be running, but abandoned. 4423 // Prerender should be running, but abandoned.
4420 EXPECT_TRUE( 4424 EXPECT_TRUE(
4421 GetAutocompleteActionPredictor()->IsPrerenderAbandonedForTesting()); 4425 GetAutocompleteActionPredictor()->IsPrerenderAbandonedForTesting());
4422 } 4426 }
4423 4427
4424 } // namespace prerender 4428 } // namespace prerender
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/debugger/debugger_api.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698