OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
7 #include "chrome/browser/ui/browser_list.h" | 7 #include "chrome/browser/ui/browser_list.h" |
8 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/test/base/in_process_browser_test.h" | 10 #include "chrome/test/base/in_process_browser_test.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 " }" | 41 " }" |
42 "</script>" | 42 "</script>" |
43 "</body></html>"; | 43 "</body></html>"; |
44 GURL url("data:text/html," + HTML); | 44 GURL url("data:text/html," + HTML); |
45 CommandLine::ForCurrentProcess()->AppendSwitch( | 45 CommandLine::ForCurrentProcess()->AppendSwitch( |
46 switches::kDisablePopupBlocking); | 46 switches::kDisablePopupBlocking); |
47 | 47 |
48 ui_test_utils::WindowedNotificationObserver tab_added_observer( | 48 ui_test_utils::WindowedNotificationObserver tab_added_observer( |
49 content::NOTIFICATION_TAB_ADDED, | 49 content::NOTIFICATION_TAB_ADDED, |
50 NotificationService::AllSources()); | 50 NotificationService::AllSources()); |
51 browser()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED); | 51 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); |
52 tab_added_observer.Wait(); | 52 tab_added_observer.Wait(); |
53 | 53 |
54 // Find the new browser. | 54 // Find the new browser. |
55 Browser* new_browser = NULL; | 55 Browser* new_browser = NULL; |
56 for (BrowserList::const_iterator i = BrowserList::begin(); | 56 for (BrowserList::const_iterator i = BrowserList::begin(); |
57 i != BrowserList::end() && !new_browser; ++i) { | 57 i != BrowserList::end() && !new_browser; ++i) { |
58 if (*i != browser()) | 58 if (*i != browser()) |
59 new_browser = *i; | 59 new_browser = *i; |
60 } | 60 } |
61 | 61 |
(...skipping 22 matching lines...) Expand all Loading... |
84 " }" | 84 " }" |
85 "</script>" | 85 "</script>" |
86 "</body></html>"; | 86 "</body></html>"; |
87 GURL url("data:text/html," + HTML); | 87 GURL url("data:text/html," + HTML); |
88 CommandLine::ForCurrentProcess()->AppendSwitch( | 88 CommandLine::ForCurrentProcess()->AppendSwitch( |
89 switches::kDisablePopupBlocking); | 89 switches::kDisablePopupBlocking); |
90 int old_tab_count = browser()->tab_count(); | 90 int old_tab_count = browser()->tab_count(); |
91 ui_test_utils::WindowedNotificationObserver tab_added_observer( | 91 ui_test_utils::WindowedNotificationObserver tab_added_observer( |
92 content::NOTIFICATION_TAB_ADDED, | 92 content::NOTIFICATION_TAB_ADDED, |
93 NotificationService::AllSources()); | 93 NotificationService::AllSources()); |
94 browser()->OpenURL(url, GURL(), CURRENT_TAB, PageTransition::TYPED); | 94 browser()->OpenURL(url, GURL(), CURRENT_TAB, content::PAGE_TRANSITION_TYPED); |
95 tab_added_observer.Wait(); | 95 tab_added_observer.Wait(); |
96 | 96 |
97 // Shouldn't find a new browser. | 97 // Shouldn't find a new browser. |
98 Browser* new_browser = NULL; | 98 Browser* new_browser = NULL; |
99 for (BrowserList::const_iterator i = BrowserList::begin(); | 99 for (BrowserList::const_iterator i = BrowserList::begin(); |
100 i != BrowserList::end() && !new_browser; ++i) { | 100 i != BrowserList::end() && !new_browser; ++i) { |
101 if (*i != browser()) | 101 if (*i != browser()) |
102 new_browser = *i; | 102 new_browser = *i; |
103 } | 103 } |
104 EXPECT_FALSE(new_browser); | 104 EXPECT_FALSE(new_browser); |
105 | 105 |
106 // Should find a new tab. | 106 // Should find a new tab. |
107 EXPECT_EQ(old_tab_count + 1, browser()->tab_count()); | 107 EXPECT_EQ(old_tab_count + 1, browser()->tab_count()); |
108 } | 108 } |
109 | 109 |
110 } // namespace chromeos | 110 } // namespace chromeos |
OLD | NEW |