diff options
33 files changed, 101 insertions, 137 deletions
diff --git a/chrome/browser/app_controller_mac_browsertest.mm b/chrome/browser/app_controller_mac_browsertest.mm index 84605c2..ae67626 100644 --- a/chrome/browser/app_controller_mac_browsertest.mm +++ b/chrome/browser/app_controller_mac_browsertest.mm @@ -18,9 +18,7 @@ namespace { class AppControllerPlatformAppBrowserTest : public InProcessBrowserTest { protected: - AppControllerPlatformAppBrowserTest() { - set_initial_window_required(false); - } + AppControllerPlatformAppBrowserTest() {} virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { InProcessBrowserTest::SetUpCommandLine(command_line); @@ -35,19 +33,17 @@ IN_PROC_BROWSER_TEST_F(AppControllerPlatformAppBrowserTest, PlatformAppReopenWithWindows) { scoped_nsobject<AppController> ac([[AppController alloc] init]); NSUInteger old_window_count = [[NSApp windows] count]; - EXPECT_EQ(0u, BrowserList::size()); + EXPECT_EQ(1u, BrowserList::size()); BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:YES]; EXPECT_TRUE(result); EXPECT_EQ(old_window_count, [[NSApp windows] count]); - EXPECT_EQ(0u, BrowserList::size()); + EXPECT_EQ(1u, BrowserList::size()); } class AppControllerWebAppBrowserTest : public InProcessBrowserTest { protected: - AppControllerWebAppBrowserTest() { - set_initial_window_required(false); - } + AppControllerWebAppBrowserTest() {} virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { InProcessBrowserTest::SetUpCommandLine(command_line); @@ -64,11 +60,11 @@ class AppControllerWebAppBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(AppControllerWebAppBrowserTest, WebAppReopenWithNoWindows) { scoped_nsobject<AppController> ac([[AppController alloc] init]); - EXPECT_EQ(0u, BrowserList::size()); + EXPECT_EQ(1u, BrowserList::size()); BOOL result = [ac applicationShouldHandleReopen:NSApp hasVisibleWindows:NO]; EXPECT_FALSE(result); - EXPECT_EQ(1u, BrowserList::size()); + EXPECT_EQ(2u, BrowserList::size()); Browser* browser = *(BrowserList::begin()); GURL current_url = browser->GetSelectedWebContents()->GetURL(); diff --git a/chrome/browser/autofill/autofill_browsertest.cc b/chrome/browser/autofill/autofill_browsertest.cc index e8bc30f..99d6c2d 100644 --- a/chrome/browser/autofill/autofill_browsertest.cc +++ b/chrome/browser/autofill/autofill_browsertest.cc @@ -103,7 +103,6 @@ class WindowedPersonalDataManagerObserver : public PersonalDataManagerObserver { class AutofillTest : public InProcessBrowserTest { protected: AutofillTest() { - set_show_window(true); EnableDOMAutomation(); } diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index 0d037f5..a8bb927 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -158,7 +158,6 @@ class BrowserFocusTest : public InProcessBrowserTest { location_bar_focus_view_id_(VIEW_ID_LOCATION_BAR) #endif { - set_show_window(true); EnableDOMAutomation(); } diff --git a/chrome/browser/browser_keyevents_browsertest.cc b/chrome/browser/browser_keyevents_browsertest.cc index ca40d13..bb75238 100644 --- a/chrome/browser/browser_keyevents_browsertest.cc +++ b/chrome/browser/browser_keyevents_browsertest.cc @@ -128,7 +128,6 @@ class TestFinishObserver : public content::NotificationObserver { class BrowserKeyEventsTest : public InProcessBrowserTest { public: BrowserKeyEventsTest() { - set_show_window(true); EnableDOMAutomation(); } diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc index 83bfce8..1365f2fe 100644 --- a/chrome/browser/chrome_browser_main.cc +++ b/chrome/browser/chrome_browser_main.cc @@ -1791,17 +1791,6 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { // http://crbug.com/105065. browser_process_->notification_ui_manager(); - if (parameters().ui_task) { - // We are in test mode. Run one task and enter the main message loop. - process_singleton_->Unlock(); -#if defined(OS_MACOSX) - if (parameters().autorelease_pool) - parameters().autorelease_pool->Recycle(); -#endif - parameters().ui_task->Run(); - delete parameters().ui_task; - run_message_loop_ = false; - } else { // Most general initialization is behind us, but opening a // tab and/or session restore and such is still to be done. base::TimeTicks browser_open_start = base::TimeTicks::Now(); @@ -1864,11 +1853,16 @@ int ChromeBrowserMainParts::PreMainMessageLoopRunImpl() { } else { run_message_loop_ = false; } - } browser_init_.reset(); PostBrowserStart(); + if (parameters().ui_task) { + parameters().ui_task->Run(); + delete parameters().ui_task; + run_message_loop_ = false; + } + return result_code_; } diff --git a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc index 598f964..99b7ce5 100644 --- a/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/existing_user_controller_browsertest.cc @@ -120,6 +120,8 @@ class ExistingUserControllerTest : public CrosInProcessBrowserTest { cros_mock_->SetStatusAreaMocksExpectations(); mock_network_library_ = cros_mock_->mock_network_library(); + EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) + .Times(AnyNumber()); MockSessionManagerClient* mock_session_manager_client = mock_dbus_thread_manager->mock_session_manager_client(); EXPECT_CALL(*mock_session_manager_client, EmitLoginPromptReady()) diff --git a/chrome/browser/chromeos/login/login_browsertest.cc b/chrome/browser/chromeos/login/login_browsertest.cc index c4ee33d..de96735 100644 --- a/chrome/browser/chromeos/login/login_browsertest.cc +++ b/chrome/browser/chromeos/login/login_browsertest.cc @@ -18,12 +18,15 @@ namespace chromeos { using ::testing::_; +using ::testing::AnyNumber; using ::testing::AtLeast; using ::testing::Return; class LoginTestBase : public CrosInProcessBrowserTest { public: - LoginTestBase() : mock_cryptohome_library_(NULL) { + LoginTestBase() + : mock_cryptohome_library_(NULL), + mock_network_library_(NULL) { } protected: @@ -32,11 +35,15 @@ class LoginTestBase : public CrosInProcessBrowserTest { cros_mock_->SetStatusAreaMocksExpectations(); cros_mock_->InitMockCryptohomeLibrary(); mock_cryptohome_library_ = cros_mock_->mock_cryptohome_library(); + mock_network_library_ = cros_mock_->mock_network_library(); EXPECT_CALL(*mock_cryptohome_library_, IsMounted()) .WillRepeatedly(Return(true)); + EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) + .Times(AnyNumber()); } MockCryptohomeLibrary* mock_cryptohome_library_; + MockNetworkLibrary* mock_network_library_; private: DISALLOW_COPY_AND_ASSIGN(LoginTestBase); diff --git a/chrome/browser/chromeos/login/network_screen_browsertest.cc b/chrome/browser/chromeos/login/network_screen_browsertest.cc index a00e252..0d83123 100644 --- a/chrome/browser/chromeos/login/network_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/network_screen_browsertest.cc @@ -66,6 +66,8 @@ class NetworkScreenTest : public WizardInProcessBrowserTest { // Minimal set of expectations needed on NetworkScreen initialization. // Status bar expectations are defined with RetiresOnSaturation() so // these mocks will be active once status bar is initialized. + EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) + .Times(AnyNumber()); EXPECT_CALL(*mock_network_library_, wifi_connected()) .Times(1) .WillRepeatedly(Return(false)); @@ -111,6 +113,7 @@ class NetworkScreenTest : public WizardInProcessBrowserTest { } virtual void SetUpOnMainThread() { + WizardInProcessBrowserTest::SetUpOnMainThread(); mock_screen_observer_.reset(new MockScreenObserver()); ASSERT_TRUE(WizardController::default_controller() != NULL); network_screen_ = diff --git a/chrome/browser/chromeos/login/update_screen_browsertest.cc b/chrome/browser/chromeos/login/update_screen_browsertest.cc index dd55b2e..293c1ff 100644 --- a/chrome/browser/chromeos/login/update_screen_browsertest.cc +++ b/chrome/browser/chromeos/login/update_screen_browsertest.cc @@ -71,6 +71,8 @@ class UpdateScreenTest : public WizardInProcessBrowserTest { EXPECT_CALL(*mock_network_library_, AddNetworkManagerObserver(_)) .Times(1) .RetiresOnSaturation(); + EXPECT_CALL(*mock_network_library_, AddUserActionObserver(_)) + .Times(AnyNumber()); EXPECT_CALL(*mock_network_library_, FindWifiDevice()) .Times(AnyNumber()); EXPECT_CALL(*mock_network_library_, FindEthernetDevice()) @@ -78,6 +80,7 @@ class UpdateScreenTest : public WizardInProcessBrowserTest { } virtual void SetUpOnMainThread() { + WizardInProcessBrowserTest::SetUpOnMainThread(); mock_screen_observer_.reset(new MockScreenObserver()); ASSERT_TRUE(WizardController::default_controller() != NULL); update_screen_ = WizardController::default_controller()->GetUpdateScreen(); diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc index daffe55..073ddbe 100644 --- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc +++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc @@ -106,8 +106,8 @@ class WizardControllerFlowTest : public WizardControllerTest { protected: WizardControllerFlowTest() {} // Overriden from InProcessBrowserTest: - virtual Browser* CreateBrowser(Profile* profile) { - Browser* ret = WizardControllerTest::CreateBrowser(profile); + virtual void SetUpOnMainThread() OVERRIDE { + WizardControllerTest::SetUpOnMainThread(); // Make sure that OOBE is run as an "official" build. WizardController::default_controller()->is_official_build_ = true; @@ -129,8 +129,6 @@ class WizardControllerFlowTest : public WizardControllerTest { EXPECT_CALL(*mock_network_screen_, Show()).Times(1); WizardController::default_controller()->AdvanceToScreen( WizardController::kNetworkScreenName); - - return ret; } void OnExit(ScreenObserver::ExitCodes exit_code) { diff --git a/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc b/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc index cfcdd86..a5f81aab 100644 --- a/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc +++ b/chrome/browser/chromeos/login/wizard_in_process_browser_test.cc @@ -4,12 +4,14 @@ #include "chrome/browser/chromeos/login/wizard_in_process_browser_test.h" +#include "base/command_line.h" #include "base/message_loop.h" #include "chrome/browser/chromeos/login/base_login_display_host.h" #include "chrome/browser/chromeos/login/wizard_controller.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/views/browser_dialogs.h" #include "chrome/common/chrome_notification_types.h" +#include "chrome/common/chrome_switches.h" #include "chrome/test/base/ui_test_utils.h" #include "content/public/browser/notification_service.h" @@ -20,7 +22,11 @@ WizardInProcessBrowserTest::WizardInProcessBrowserTest(const char* screen_name) host_(NULL) { } -Browser* WizardInProcessBrowserTest::CreateBrowser(Profile* profile) { +void WizardInProcessBrowserTest::SetUpCommandLine(CommandLine* command_line) { + command_line->AppendSwitch(switches::kNoStartupWindow); +} + +void WizardInProcessBrowserTest::SetUpOnMainThread() { SetUpWizard(); WizardController::SetZeroDelays(); @@ -29,22 +35,13 @@ Browser* WizardInProcessBrowserTest::CreateBrowser(Profile* profile) { browser::ShowLoginWizard(screen_name_.c_str(), gfx::Size(1024, 600)); host_ = BaseLoginDisplayHost::default_host(); } - return NULL; } void WizardInProcessBrowserTest::CleanUpOnMainThread() { - ui_test_utils::WindowedNotificationObserver wizard_destroyed_observer( - chrome::NOTIFICATION_WIZARD_CONTENT_VIEW_DESTROYED, - content::NotificationService::AllSources()); - // LoginDisplayHost owns controllers and all windows. MessageLoopForUI::current()->DeleteSoon(FROM_HERE, host_); - // Observers and what not are notified after the views are deleted, which - // happens after a delay (because they are contained in a NativeWidgetGtk - // which delays deleting itself). Run the message loop until we know the - // wizard has been deleted. - wizard_destroyed_observer.Wait(); + ui_test_utils::RunMessageLoop(); } } // namespace chromeos diff --git a/chrome/browser/chromeos/login/wizard_in_process_browser_test.h b/chrome/browser/chromeos/login/wizard_in_process_browser_test.h index 9b0f4c9..da70ee5 100644 --- a/chrome/browser/chromeos/login/wizard_in_process_browser_test.h +++ b/chrome/browser/chromeos/login/wizard_in_process_browser_test.h @@ -33,7 +33,8 @@ class WizardInProcessBrowserTest : public CrosInProcessBrowserTest { virtual void SetUpWizard() {} // Overriden from InProcessBrowserTest: - virtual Browser* CreateBrowser(Profile* profile) OVERRIDE; + virtual void SetUpOnMainThread() OVERRIDE; + virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; virtual void CleanUpOnMainThread() OVERRIDE; private: diff --git a/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc b/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc index a3d42e2..a6bdf2a 100644 --- a/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc +++ b/chrome/browser/chromeos/tab_closeable_state_watcher_browsertest.cc @@ -30,8 +30,6 @@ namespace chromeos { class TabCloseableStateWatcherTest : public InProcessBrowserTest { public: TabCloseableStateWatcherTest() { - // This test is testing TabCloseStateWatcher, so enable it. - EnableTabCloseableStateWatcher(); blank_url_ = GURL(chrome::kAboutBlankURL); ntp_url_ = GURL(chrome::kChromeUINewTabURL); other_url_ = ui_test_utils::GetTestUrl( diff --git a/chrome/browser/debugger/devtools_sanity_unittest.cc b/chrome/browser/debugger/devtools_sanity_unittest.cc index 9d6e10d..128004d 100644 --- a/chrome/browser/debugger/devtools_sanity_unittest.cc +++ b/chrome/browser/debugger/devtools_sanity_unittest.cc @@ -122,7 +122,6 @@ class DevToolsSanityTest : public InProcessBrowserTest { DevToolsSanityTest() : window_(NULL), inspected_rvh_(NULL) { - set_show_window(true); EnableDOMAutomation(); } @@ -271,7 +270,6 @@ class DevToolsExperimentalExtensionTest : public DevToolsExtensionTest { class WorkerDevToolsSanityTest : public InProcessBrowserTest { public: WorkerDevToolsSanityTest() : window_(NULL) { - set_show_window(true); EnableDOMAutomation(); } diff --git a/chrome/browser/extensions/extension_tabs_apitest.cc b/chrome/browser/extensions/extension_tabs_apitest.cc index a5d7d69..d2390f4 100644 --- a/chrome/browser/extensions/extension_tabs_apitest.cc +++ b/chrome/browser/extensions/extension_tabs_apitest.cc @@ -9,7 +9,9 @@ #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" +#include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" +#include "chrome/common/url_constants.h" #include "net/base/mock_host_resolver.h" // Possible race in ChromeURLDataManager. http://crbug.com/59198 @@ -43,7 +45,19 @@ #define MAYBE_UpdateWindowResize UpdateWindowResize #endif // defined(OS_LINUX) && !defined(USE_AURA) -IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Tabs) { +class ExtensionApiNewTabTest : public ExtensionApiTest { + public: + ExtensionApiNewTabTest() {} + virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { + ExtensionApiTest::SetUpCommandLine(command_line); + // Override the default which InProcessBrowserTest adds if it doesn't see a + // homepage. + command_line->AppendSwitchASCII( + switches::kHomePage, chrome::kChromeUINewTabURL); + } +}; + +IN_PROC_BROWSER_TEST_F(ExtensionApiNewTabTest, Tabs) { // The test creates a tab and checks that the URL of the new tab // is that of the new tab page. Make sure the pref that controls // this is set. diff --git a/chrome/browser/extensions/extension_toolbar_model_browsertest.cc b/chrome/browser/extensions/extension_toolbar_model_browsertest.cc index 2e53f92..bf74f3c 100644 --- a/chrome/browser/extensions/extension_toolbar_model_browsertest.cc +++ b/chrome/browser/extensions/extension_toolbar_model_browsertest.cc @@ -25,12 +25,10 @@ class ExtensionToolbarModelTest : public ExtensionBrowserTest, ExtensionBrowserTest::SetUp(); } - virtual Browser* CreateBrowser(Profile* profile) { - Browser* b = InProcessBrowserTest::CreateBrowser(profile); - ExtensionService* service = b->profile()->GetExtensionService(); + virtual void SetUpOnMainThread() OVERRIDE { + ExtensionService* service = browser()->profile()->GetExtensionService(); model_ = service->toolbar_model(); model_->AddObserver(this); - return b; } virtual void CleanUpOnMainThread() { diff --git a/chrome/browser/instant/instant_browsertest.cc b/chrome/browser/instant/instant_browsertest.cc index 0cdb752..cd851c5 100644 --- a/chrome/browser/instant/instant_browsertest.cc +++ b/chrome/browser/instant/instant_browsertest.cc @@ -48,7 +48,6 @@ using content::WebContents; class InstantTest : public InProcessBrowserTest { public: InstantTest() { - set_show_window(true); EnableDOMAutomation(); } diff --git a/chrome/browser/sync/test/integration/sync_test.cc b/chrome/browser/sync/test/integration/sync_test.cc index e8d8595..f71c430 100644 --- a/chrome/browser/sync/test/integration/sync_test.cc +++ b/chrome/browser/sync/test/integration/sync_test.cc @@ -120,7 +120,6 @@ SyncTest::SyncTest(TestType test_type) notifications_enabled_(true), test_server_handle_(base::kNullProcessHandle), number_of_default_sync_items_(0) { - InProcessBrowserTest::set_show_window(true); sync_datatype_helper::AssociateWithTest(this); switch (test_type_) { case SINGLE_CLIENT: { diff --git a/chrome/browser/ui/browser_init.cc b/chrome/browser/ui/browser_init.cc index b33ac24..3716508 100644 --- a/chrome/browser/ui/browser_init.cc +++ b/chrome/browser/ui/browser_init.cc @@ -1705,6 +1705,7 @@ bool BrowserInit::ProcessCmdLineImpl( if (process_startup) { if (command_line.HasSwitch(switches::kDisablePromptOnRepost)) content::NavigationController::DisablePromptOnRepost(); + if (!command_line.HasSwitch(switches::kDisableComponentUpdate)) RegisterComponentsForUpdate(command_line); } diff --git a/chrome/browser/ui/browser_init_browsertest.cc b/chrome/browser/ui/browser_init_browsertest.cc index adfa5ff..1501579 100644 --- a/chrome/browser/ui/browser_init_browsertest.cc +++ b/chrome/browser/ui/browser_init_browsertest.cc @@ -485,14 +485,14 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, UpdateWithTwoProfiles) { new_browser = FindOneOtherBrowserForProfile(profile1, NULL); ASSERT_TRUE(new_browser); ASSERT_EQ(1, new_browser->tab_count()); - EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), + EXPECT_EQ(GURL(chrome::kAboutBlankURL), new_browser->GetWebContentsAt(0)->GetURL()); ASSERT_EQ(1u, BrowserList::GetBrowserCount(profile2)); new_browser = FindOneOtherBrowserForProfile(profile2, NULL); ASSERT_TRUE(new_browser); ASSERT_EQ(1, new_browser->tab_count()); - EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), + EXPECT_EQ(GURL(chrome::kAboutBlankURL), new_browser->GetWebContentsAt(0)->GetURL()); } @@ -584,7 +584,7 @@ IN_PROC_BROWSER_TEST_F(BrowserInitTest, ProfilesWithoutPagesNotLaunched) { new_browser = FindOneOtherBrowserForProfile(profile_last, NULL); ASSERT_TRUE(new_browser); ASSERT_EQ(1, new_browser->tab_count()); - EXPECT_EQ(GURL(chrome::kChromeUINewTabURL), + EXPECT_EQ(GURL(chrome::kAboutBlankURL), new_browser->GetWebContentsAt(0)->GetURL()); // profile_home2 was not launched since it would've only opened the home page. diff --git a/chrome/browser/ui/login/login_prompt_browsertest.cc b/chrome/browser/ui/login/login_prompt_browsertest.cc index e368064..3f392db 100644 --- a/chrome/browser/ui/login/login_prompt_browsertest.cc +++ b/chrome/browser/ui/login/login_prompt_browsertest.cc @@ -35,8 +35,6 @@ class LoginPromptBrowserTest : public InProcessBrowserTest { password_("secret"), username_basic_("basicuser"), username_digest_("digestuser") { - set_show_window(true); - auth_map_["foo"] = AuthInfo("testuser", "foopassword"); auth_map_["bar"] = AuthInfo("testuser", "barpassword"); auth_map_["testrealm"] = AuthInfo(username_basic_, password_); diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc index d184acd..4789864 100644 --- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc +++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc @@ -152,7 +152,6 @@ class OmniboxViewTest : public InProcessBrowserTest, protected: OmniboxViewTest() : location_bar_focus_view_id_(VIEW_ID_LOCATION_BAR) { - set_show_window(true); } virtual void SetUpOnMainThread() { diff --git a/chrome/browser/ui/views/browser_actions_container_browsertest.cc b/chrome/browser/ui/views/browser_actions_container_browsertest.cc index 5e978e9..f2a79da 100644 --- a/chrome/browser/ui/views/browser_actions_container_browsertest.cc +++ b/chrome/browser/ui/views/browser_actions_container_browsertest.cc @@ -13,18 +13,14 @@ class BrowserActionsContainerTest : public ExtensionBrowserTest { public: - BrowserActionsContainerTest() : browser_(NULL) { + BrowserActionsContainerTest() { } virtual ~BrowserActionsContainerTest() {} - virtual Browser* CreateBrowser(Profile* profile) { - browser_ = InProcessBrowserTest::CreateBrowser(profile); - browser_actions_bar_.reset(new BrowserActionTestUtil(browser_)); - return browser_; + virtual void SetUpOnMainThread() OVERRIDE { + browser_actions_bar_.reset(new BrowserActionTestUtil(browser())); } - Browser* browser() { return browser_; } - BrowserActionTestUtil* browser_actions_bar() { return browser_actions_bar_.get(); } @@ -41,8 +37,6 @@ class BrowserActionsContainerTest : public ExtensionBrowserTest { private: scoped_ptr<BrowserActionTestUtil> browser_actions_bar_; - - Browser* browser_; // Weak. }; // Test the basic functionality. diff --git a/chrome/browser/ui/views/constrained_window_views_browsertest.cc b/chrome/browser/ui/views/constrained_window_views_browsertest.cc index 4b62f54..f2fedab 100644 --- a/chrome/browser/ui/views/constrained_window_views_browsertest.cc +++ b/chrome/browser/ui/views/constrained_window_views_browsertest.cc @@ -94,7 +94,6 @@ class TestConstrainedDialog : public views::DialogDelegate { class ConstrainedWindowViewTest : public InProcessBrowserTest { public: ConstrainedWindowViewTest() { - set_show_window(true); } }; diff --git a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc index 7764bcf..00532e7 100644 --- a/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc +++ b/chrome/browser/ui/views/find_bar_host_interactive_uitest.cc @@ -47,7 +47,6 @@ class FindInPageTest : public InProcessBrowserTest { location_bar_focus_view_id_(VIEW_ID_LOCATION_BAR) #endif { - set_show_window(true); FindBarHost::disable_animations_during_testing_ = true; } diff --git a/chrome/browser/ui/webui/inspect_ui_browsertest.cc b/chrome/browser/ui/webui/inspect_ui_browsertest.cc index 43f2261..1f3e185 100644 --- a/chrome/browser/ui/webui/inspect_ui_browsertest.cc +++ b/chrome/browser/ui/webui/inspect_ui_browsertest.cc @@ -21,7 +21,6 @@ const char kSharedWorkerJs[] = class InspectUITest : public InProcessBrowserTest { public: InspectUITest() { - set_show_window(true); EnableDOMAutomation(); } diff --git a/chrome/common/chrome_notification_types.h b/chrome/common/chrome_notification_types.h index b2a161e..7d92902 100644 --- a/chrome/common/chrome_notification_types.h +++ b/chrome/common/chrome_notification_types.h @@ -867,10 +867,6 @@ enum NotificationType { // may not be fully rendered at this point. NOTIFICATION_WIZARD_FIRST_SCREEN_SHOWN, - // Sent when the wizard's content view is destroyed. The source and details - // are not used. - NOTIFICATION_WIZARD_CONTENT_VIEW_DESTROYED, - // Sent when the screen lock state has changed. The source is // ScreenLocker and the details is a bool specifing that the // screen is locked. When details is a false, the source object diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index d4d159c..5fedf03 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -267,6 +267,8 @@ const char kDisableChromeToMobile[] = "disable-chrome-to-mobile"; const char kDisableClientSidePhishingDetection[] = "disable-client-side-phishing-detection"; +const char kDisableComponentUpdate[] = "disable-component-update"; + // Disables establishing a backup TCP connection if a specified timeout is // exceeded. const char kDisableConnectBackupJobs[] = "disable-connect-backup-jobs"; @@ -405,12 +407,6 @@ const char kDisableSyncThemes[] = "disable-sync-themes"; // Disables syncing browser typed urls. const char kDisableSyncTypedUrls[] = "disable-sync-typed-urls"; -// TabCloseableStateWatcher disallows closing of tabs and browsers under -// certain situations on ChromeOS. Some tests expect tabs or browsers to close, -// so we need a switch to disable the watcher. -const char kDisableTabCloseableStateWatcher[] = - "disable-tab-closeable-state-watcher"; - // Disables TLS v1.0 (usually for testing purposes). const char kDisableTLS1[] = "disable-tls1"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 4dcf372..c616867 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -81,6 +81,7 @@ extern const char kDisableBackgroundNetworking[]; extern const char kDisableBundledPpapiFlash[]; extern const char kDisableChromeToMobile[]; extern const char kDisableClientSidePhishingDetection[]; +extern const char kDisableComponentUpdate[]; extern const char kDisableConnectBackupJobs[]; extern const char kDisableCRLSets[]; extern const char kDisableCustomJumpList[]; @@ -120,7 +121,6 @@ extern const char kDisableSyncPreferences[]; extern const char kDisableSyncSearchEngines[]; extern const char kDisableSyncThemes[]; extern const char kDisableSyncTypedUrls[]; -extern const char kDisableTabCloseableStateWatcher[]; extern const char kDisableTLS1[]; extern const char kDisableTranslate[]; extern const char kDisableWebResources[]; diff --git a/chrome/test/automation/proxy_launcher.cc b/chrome/test/automation/proxy_launcher.cc index 9d1d8cf..30bcfb4 100644 --- a/chrome/test/automation/proxy_launcher.cc +++ b/chrome/test/automation/proxy_launcher.cc @@ -427,9 +427,6 @@ void ProxyLauncher::PrepareTestCommandline(CommandLine* command_line, command_line->AppendSwitch(switches::kDebugOnStart); #endif - // Disable TabCloseableStateWatcher for tests. - command_line->AppendSwitch(switches::kDisableTabCloseableStateWatcher); - // Force the app to always exit when the last browser window is closed. command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests); diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc index a99bc7b..75146ed 100644 --- a/chrome/test/base/in_process_browser_test.cc +++ b/chrome/test/base/in_process_browser_test.cc @@ -56,10 +56,7 @@ const char kBrowserTestType[] = "browser"; InProcessBrowserTest::InProcessBrowserTest() : browser_(NULL), - show_window_(false), - initial_window_required_(true), - dom_automation_enabled_(false), - tab_closeable_state_watcher_enabled_(false) + dom_automation_enabled_(false) #if defined(OS_POSIX) , handle_sigterm_(true) #endif @@ -140,6 +137,16 @@ void InProcessBrowserTest::SetUp() { net::ScopedDefaultHostResolverProc scoped_host_resolver_proc( host_resolver_.get()); +#if defined(OS_MACOSX) + // On Mac, without the following autorelease pool, code which is directly + // executed (as opposed to executed inside a message loop) would autorelease + // objects into a higher-level pool. This pool is not recycled in-sync with + // the message loops' pools and causes problems with code relying on + // deallocation via an autorelease pool (such as browser window closure and + // browser shutdown). To avoid this, the following pool is recycled after each + // time code is directly executed. + autorelease_pool_ = new base::mac::ScopedNSAutoreleasePool; +#endif BrowserTestBase::SetUp(); } @@ -176,12 +183,15 @@ void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) { subprocess_path); #endif - // If neccessary, disable TabCloseableStateWatcher. - if (!tab_closeable_state_watcher_enabled_) - command_line->AppendSwitch(switches::kDisableTabCloseableStateWatcher); - // TODO(pkotwicz): Investigate if we can remove this switch. command_line->AppendSwitch(switches::kDisableZeroBrowsersOpenForTests); + + if (!command_line->HasSwitch(switches::kHomePage)) { + command_line->AppendSwitchASCII( + switches::kHomePage, chrome::kAboutBlankURL); + } + if (command_line->GetArgs().empty()) + command_line->AppendArg(chrome::kAboutBlankURL); } bool InProcessBrowserTest::CreateUserDataDirectory() { @@ -328,31 +338,16 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() { signal(SIGTERM, DumpStackTraceSignalHandler); #endif // defined(OS_POSIX) -#if defined(OS_MACOSX) - // On Mac, without the following autorelease pool, code which is directly - // executed (as opposed to executed inside a message loop) would autorelease - // objects into a higher-level pool. This pool is not recycled in-sync with - // the message loops' pools and causes problems with code relying on - // deallocation via an autorelease pool (such as browser window closure and - // browser shutdown). To avoid this, the following pool is recycled after each - // time code is directly executed. - base::mac::ScopedNSAutoreleasePool pool; - AutoReset<base::mac::ScopedNSAutoreleasePool*> autorelease_pool_reset( - &autorelease_pool_, &pool); -#endif - // Pump startup related events. ui_test_utils::RunAllPendingInMessageLoop(); #if defined(OS_MACOSX) - pool.Recycle(); + autorelease_pool_->Recycle(); #endif - if (initial_window_required_) { - browser_ = CreateBrowser(ProfileManager::GetDefaultProfile()); -#if defined(OS_MACOSX) - pool.Recycle(); -#endif + if (BrowserList::size()) { + browser_ = *BrowserList::begin(); + ui_test_utils::WaitForLoadStop(browser_->GetSelectedWebContents()); } // Pump any pending events that were created as a result of creating a @@ -361,26 +356,23 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() { SetUpOnMainThread(); #if defined(OS_MACOSX) - pool.Recycle(); + autorelease_pool_->Recycle(); #endif if (!HasFatalFailure()) RunTestOnMainThread(); #if defined(OS_MACOSX) - pool.Recycle(); + autorelease_pool_->Recycle(); #endif // Invoke cleanup and quit even if there are failures. This is similar to // gtest in that it invokes TearDown even if Setup fails. CleanUpOnMainThread(); #if defined(OS_MACOSX) - pool.Recycle(); + autorelease_pool_->Recycle(); #endif QuitBrowsers(); -#if defined(OS_MACOSX) - pool.Recycle(); -#endif } void InProcessBrowserTest::QuitBrowsers() { @@ -393,4 +385,9 @@ void InProcessBrowserTest::QuitBrowsers() { MessageLoopForUI::current()->PostTask(FROM_HERE, base::Bind(&BrowserList::AttemptExit)); ui_test_utils::RunMessageLoop(); + +#if defined(OS_MACOSX) + delete autorelease_pool_; + autorelease_pool_ = NULL; +#endif } diff --git a/chrome/test/base/in_process_browser_test.h b/chrome/test/base/in_process_browser_test.h index e695912..2636b9a 100644 --- a/chrome/test/base/in_process_browser_test.h +++ b/chrome/test/base/in_process_browser_test.h @@ -143,10 +143,10 @@ class InProcessBrowserTest : public BrowserTestBase { // finish loading and shows the browser. // // This is invoked from Setup. - virtual Browser* CreateBrowser(Profile* profile); + Browser* CreateBrowser(Profile* profile); // Similar to |CreateBrowser|, but creates an incognito browser. - virtual Browser* CreateIncognitoBrowser(); + Browser* CreateIncognitoBrowser(); // Creates a browser for a popup window with a single tab (about:blank), waits // for the tab to finish loading, and shows the browser. @@ -178,14 +178,7 @@ class InProcessBrowserTest : public BrowserTestBase { // Sets some test states (see below for comments). Call this in your test // constructor. - void set_show_window(bool show) { show_window_ = show; } - void set_initial_window_required(bool flag) { - initial_window_required_= flag; - } void EnableDOMAutomation() { dom_automation_enabled_ = true; } - void EnableTabCloseableStateWatcher() { - tab_closeable_state_watcher_enabled_ = true; - } #if defined(OS_POSIX) // This is only needed by a test that raises SIGTERM to ensure that a specific // codepath is taken. @@ -222,20 +215,10 @@ class InProcessBrowserTest : public BrowserTestBase { // ContentRendererClient when running in single-process mode. scoped_ptr<content::ContentRendererClient> single_process_renderer_client_; - // Whether this test requires the browser windows to be shown (interactive - // tests for example need the windows shown). - bool show_window_; - - // Whether this test requires an initial window. - bool initial_window_required_; - // Whether the JavaScript can access the DOMAutomationController (a JS object // that can send messages back to the browser). bool dom_automation_enabled_; - // Whether this test requires the TabCloseableStateWatcher. - bool tab_closeable_state_watcher_enabled_; - // Host resolver to use during the test. scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_; diff --git a/chrome/test/base/test_launcher_utils.cc b/chrome/test/base/test_launcher_utils.cc index 31b9543..e76b682 100644 --- a/chrome/test/base/test_launcher_utils.cc +++ b/chrome/test/base/test_launcher_utils.cc @@ -75,6 +75,8 @@ void PrepareBrowserCommandLineForTests(CommandLine* command_line) { // Disable the Instant field trial, which may cause unexpected page loads. if (!command_line->HasSwitch(switches::kInstantFieldTrial)) command_line->AppendSwitchASCII(switches::kInstantFieldTrial, "disabled"); + + command_line->AppendSwitch(switches::kDisableComponentUpdate); } bool OverrideUserDataDir(const FilePath& user_data_dir) { |