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 #if defined(OS_POSIX) | 5 #if defined(OS_POSIX) |
6 #include <signal.h> | 6 #include <signal.h> |
7 #endif | 7 #endif |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 | 102 |
103 const std::string CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER = | 103 const std::string CLOSE_TAB_WHEN_OTHER_TAB_HAS_LISTENER = |
104 "<html><head><title>only_one_unload</title></head>" | 104 "<html><head><title>only_one_unload</title></head>" |
105 "<body onclick=\"window.open('data:text/html," | 105 "<body onclick=\"window.open('data:text/html," |
106 "<html><head><title>popup</title></head></body>')\" " | 106 "<html><head><title>popup</title></head></body>')\" " |
107 "onbeforeunload='return;'>" | 107 "onbeforeunload='return;'>" |
108 "</body></html>"; | 108 "</body></html>"; |
109 | 109 |
110 class UnloadTest : public InProcessBrowserTest { | 110 class UnloadTest : public InProcessBrowserTest { |
111 public: | 111 public: |
112 virtual void SetUpCommandLine(CommandLine* command_line) { | 112 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
113 const testing::TestInfo* const test_info = | 113 const testing::TestInfo* const test_info = |
114 testing::UnitTest::GetInstance()->current_test_info(); | 114 testing::UnitTest::GetInstance()->current_test_info(); |
115 if (strcmp(test_info->name(), | 115 if (strcmp(test_info->name(), |
116 "BrowserCloseTabWhenOtherTabHasListener") == 0) { | 116 "BrowserCloseTabWhenOtherTabHasListener") == 0) { |
117 command_line->AppendSwitch(switches::kDisablePopupBlocking); | 117 command_line->AppendSwitch(switches::kDisablePopupBlocking); |
118 } else if (strcmp(test_info->name(), "BrowserTerminateBeforeUnload") == 0) { | 118 } else if (strcmp(test_info->name(), "BrowserTerminateBeforeUnload") == 0) { |
119 #if defined(OS_POSIX) | 119 #if defined(OS_POSIX) |
120 DisableSIGTERMHandling(); | 120 DisableSIGTERMHandling(); |
121 #endif | 121 #endif |
122 } | 122 } |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 407 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
408 content::NotificationService::AllSources()); | 408 content::NotificationService::AllSources()); |
409 chrome::CloseTab(browser()); | 409 chrome::CloseTab(browser()); |
410 tab_close_observer.Wait(); | 410 tab_close_observer.Wait(); |
411 | 411 |
412 CheckTitle("only_one_unload"); | 412 CheckTitle("only_one_unload"); |
413 } | 413 } |
414 | 414 |
415 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs | 415 // TODO(ojan): Add tests for unload/beforeunload that have multiple tabs |
416 // and multiple windows. | 416 // and multiple windows. |
OLD | NEW |