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

Side by Side Diff: chrome/browser/debugger/devtools_sanity_browsertest.cc

Issue 10702029: Move tab functions off Browser into browser_tabstrip and browser_tabrestore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/cancelable_callback.h" 6 #include "base/cancelable_callback.h"
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/test/test_timeouts.h" 12 #include "base/test/test_timeouts.h"
13 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
14 #include "chrome/browser/debugger/devtools_window.h" 14 #include "chrome/browser/debugger/devtools_window.h"
15 #include "chrome/browser/extensions/extension_service.h" 15 #include "chrome/browser/extensions/extension_service.h"
16 #include "chrome/browser/extensions/unpacked_installer.h" 16 #include "chrome/browser/extensions/unpacked_installer.h"
17 #include "chrome/browser/profiles/profile.h" 17 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
19 #include "chrome/browser/ui/browser_commands.h" 19 #include "chrome/browser/ui/browser_commands.h"
20 #include "chrome/browser/ui/browser_tabstrip.h"
20 #include "chrome/browser/ui/tab_contents/tab_contents.h" 21 #include "chrome/browser/ui/tab_contents/tab_contents.h"
21 #include "chrome/common/chrome_notification_types.h" 22 #include "chrome/common/chrome_notification_types.h"
22 #include "chrome/common/chrome_paths.h" 23 #include "chrome/common/chrome_paths.h"
23 #include "chrome/common/chrome_switches.h" 24 #include "chrome/common/chrome_switches.h"
24 #include "chrome/test/base/in_process_browser_test.h" 25 #include "chrome/test/base/in_process_browser_test.h"
25 #include "chrome/test/base/ui_test_utils.h" 26 #include "chrome/test/base/ui_test_utils.h"
26 #include "content/public/browser/child_process_data.h" 27 #include "content/public/browser/child_process_data.h"
27 #include "content/public/browser/content_browser_client.h" 28 #include "content/public/browser/content_browser_client.h"
28 #include "content/public/browser/devtools_agent_host_registry.h" 29 #include "content/public/browser/devtools_agent_host_registry.h"
29 #include "content/public/browser/devtools_client_host.h" 30 #include "content/public/browser/devtools_client_host.h"
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 140
140 ui_test_utils::WindowedNotificationObserver observer( 141 ui_test_utils::WindowedNotificationObserver observer(
141 content::NOTIFICATION_LOAD_STOP, 142 content::NOTIFICATION_LOAD_STOP,
142 content::NotificationService::AllSources()); 143 content::NotificationService::AllSources());
143 inspected_rvh_ = GetInspectedTab()->GetRenderViewHost(); 144 inspected_rvh_ = GetInspectedTab()->GetRenderViewHost();
144 window_ = DevToolsWindow::OpenDevToolsWindow(inspected_rvh_); 145 window_ = DevToolsWindow::OpenDevToolsWindow(inspected_rvh_);
145 observer.Wait(); 146 observer.Wait();
146 } 147 }
147 148
148 WebContents* GetInspectedTab() { 149 WebContents* GetInspectedTab() {
149 return browser()->GetWebContentsAt(0); 150 return chrome::GetWebContentsAt(browser(), 0);
150 } 151 }
151 152
152 void CloseDevToolsWindow() { 153 void CloseDevToolsWindow() {
153 DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); 154 DevToolsManager* devtools_manager = DevToolsManager::GetInstance();
154 // UnregisterDevToolsClientHostFor may destroy window_ so store the browser 155 // UnregisterDevToolsClientHostFor may destroy window_ so store the browser
155 // first. 156 // first.
156 Browser* browser = window_->browser(); 157 Browser* browser = window_->browser();
157 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost( 158 DevToolsAgentHost* agent = DevToolsAgentHostRegistry::GetDevToolsAgentHost(
158 inspected_rvh_); 159 inspected_rvh_);
159 devtools_manager->UnregisterDevToolsClientHostFor(agent); 160 devtools_manager->UnregisterDevToolsClientHostFor(agent);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 ui_test_utils::WindowedNotificationObserver observer( 400 ui_test_utils::WindowedNotificationObserver observer(
400 content::NOTIFICATION_LOAD_STOP, 401 content::NOTIFICATION_LOAD_STOP,
401 content::Source<NavigationController>( 402 content::Source<NavigationController>(
402 &client_contents->GetController())); 403 &client_contents->GetController()));
403 observer.Wait(); 404 observer.Wait();
404 } 405 }
405 } 406 }
406 407
407 void CloseDevToolsWindow() { 408 void CloseDevToolsWindow() {
408 Browser* browser = window_->browser(); 409 Browser* browser = window_->browser();
409 browser->CloseAllTabs(); 410 chrome::CloseAllTabs(browser);
410 BrowserClosedObserver close_observer(browser); 411 BrowserClosedObserver close_observer(browser);
411 } 412 }
412 413
413 DevToolsWindow* window_; 414 DevToolsWindow* window_;
414 }; 415 };
415 416
416 417
417 // Tests scripts panel showing. 418 // Tests scripts panel showing.
418 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestShowScriptsTab) { 419 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestShowScriptsTab) {
419 RunTest("testShowScriptsTab", kDebuggerTestPage); 420 RunTest("testShowScriptsTab", kDebuggerTestPage);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 #endif 528 #endif
528 // Tests that inspector will reattach to inspected page when it is reloaded 529 // Tests that inspector will reattach to inspected page when it is reloaded
529 // after a crash. See http://crbug.com/101952 530 // after a crash. See http://crbug.com/101952
530 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestReattachAfterCrash) { 531 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestReattachAfterCrash) {
531 OpenDevToolsWindow(kDebuggerTestPage); 532 OpenDevToolsWindow(kDebuggerTestPage);
532 533
533 ui_test_utils::CrashTab(GetInspectedTab()); 534 ui_test_utils::CrashTab(GetInspectedTab());
534 ui_test_utils::WindowedNotificationObserver observer( 535 ui_test_utils::WindowedNotificationObserver observer(
535 content::NOTIFICATION_LOAD_STOP, 536 content::NOTIFICATION_LOAD_STOP,
536 content::Source<NavigationController>( 537 content::Source<NavigationController>(
537 &browser()->GetActiveWebContents()->GetController())); 538 &chrome::GetActiveWebContents(browser())->GetController()));
538 chrome::Reload(browser(), CURRENT_TAB); 539 chrome::Reload(browser(), CURRENT_TAB);
539 observer.Wait(); 540 observer.Wait();
540 541
541 RunTestFunction(window_, "testReattachAfterCrash"); 542 RunTestFunction(window_, "testReattachAfterCrash");
542 CloseDevToolsWindow(); 543 CloseDevToolsWindow();
543 } 544 }
544 545
545 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestPageWithNoJavaScript) { 546 IN_PROC_BROWSER_TEST_F(DevToolsSanityTest, TestPageWithNoJavaScript) {
546 OpenDevToolsWindow("about:blank"); 547 OpenDevToolsWindow("about:blank");
547 std::string result; 548 std::string result;
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 content::CONSOLE_MESSAGE_LEVEL_LOG, 606 content::CONSOLE_MESSAGE_LEVEL_LOG,
606 "log"); 607 "log");
607 devtools_manager->AddMessageToConsole(agent_host, 608 devtools_manager->AddMessageToConsole(agent_host,
608 content::CONSOLE_MESSAGE_LEVEL_ERROR, 609 content::CONSOLE_MESSAGE_LEVEL_ERROR,
609 "error"); 610 "error");
610 RunTestFunction(window_, "checkLogAndErrorMessages"); 611 RunTestFunction(window_, "checkLogAndErrorMessages");
611 CloseDevToolsWindow(); 612 CloseDevToolsWindow();
612 } 613 }
613 614
614 } // namespace 615 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/custom_home_pages_table_model.cc ('k') | chrome/browser/debugger/devtools_window.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698