OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this |
2 // source code is governed by a BSD-style license that can be found in the | 2 // source code is governed by a BSD-style license that can be found in the |
3 // LICENSE file. | 3 // LICENSE file. |
4 | 4 |
5 #include "chrome/browser/browser.h" | 5 #include "chrome/browser/browser.h" |
| 6 #include "chrome/common/url_constants.h" |
6 #include "chrome/test/in_process_browser_test.h" | 7 #include "chrome/test/in_process_browser_test.h" |
7 #include "net/base/mock_host_resolver.h" | 8 #include "net/base/mock_host_resolver.h" |
8 | 9 |
9 class BrowserTest : public InProcessBrowserTest { | 10 class BrowserTest : public InProcessBrowserTest { |
10 public: | 11 public: |
11 BrowserTest() { | 12 BrowserTest() { |
12 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); | 13 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); |
13 // Avoid making external DNS lookups. In this test we don't need this | 14 // Avoid making external DNS lookups. In this test we don't need this |
14 // to succeed. | 15 // to succeed. |
15 host_resolver_proc_->AddSimulatedFailure("*.google.com"); | 16 host_resolver_proc_->AddSimulatedFailure("*.google.com"); |
(...skipping 13 matching lines...) Expand all Loading... |
29 | 30 |
30 // We start with a normal browser with one tab. | 31 // We start with a normal browser with one tab. |
31 EXPECT_EQ(1, browser()->tab_count()); | 32 EXPECT_EQ(1, browser()->tab_count()); |
32 | 33 |
33 // Open a popup browser with a single blank foreground tab. | 34 // Open a popup browser with a single blank foreground tab. |
34 Browser* popup_browser = browser()->CreateForPopup(browser()->profile()); | 35 Browser* popup_browser = browser()->CreateForPopup(browser()->profile()); |
35 popup_browser->AddBlankTab(true); | 36 popup_browser->AddBlankTab(true); |
36 EXPECT_EQ(1, popup_browser->tab_count()); | 37 EXPECT_EQ(1, popup_browser->tab_count()); |
37 | 38 |
38 // Now try opening another tab in the popup browser. | 39 // Now try opening another tab in the popup browser. |
39 popup_browser->AddTabWithURL(GURL("about:blank"), GURL(), | 40 popup_browser->AddTabWithURL(GURL(chrome::kAboutBlankURL), GURL(), |
40 PageTransition::TYPED, true, -1, NULL); | 41 PageTransition::TYPED, true, -1, NULL); |
41 | 42 |
42 // The popup should still only have one tab. | 43 // The popup should still only have one tab. |
43 EXPECT_EQ(1, popup_browser->tab_count()); | 44 EXPECT_EQ(1, popup_browser->tab_count()); |
44 | 45 |
45 // The normal browser should now have two. | 46 // The normal browser should now have two. |
46 EXPECT_EQ(2, browser()->tab_count()); | 47 EXPECT_EQ(2, browser()->tab_count()); |
47 | 48 |
48 // Open an app frame browser with a single blank foreground tab. | 49 // Open an app frame browser with a single blank foreground tab. |
49 Browser* app_browser = | 50 Browser* app_browser = |
50 browser()->CreateForApp(L"Test", browser()->profile(), false); | 51 browser()->CreateForApp(L"Test", browser()->profile(), false); |
51 app_browser->AddBlankTab(true); | 52 app_browser->AddBlankTab(true); |
52 EXPECT_EQ(1, app_browser->tab_count()); | 53 EXPECT_EQ(1, app_browser->tab_count()); |
53 | 54 |
54 // Now try opening another tab in the app browser. | 55 // Now try opening another tab in the app browser. |
55 app_browser->AddTabWithURL(GURL("about:blank"), GURL(), | 56 app_browser->AddTabWithURL(GURL(chrome::kAboutBlankURL), GURL(), |
56 PageTransition::TYPED, true, -1, NULL); | 57 PageTransition::TYPED, true, -1, NULL); |
57 | 58 |
58 // The popup should still only have one tab. | 59 // The popup should still only have one tab. |
59 EXPECT_EQ(1, app_browser->tab_count()); | 60 EXPECT_EQ(1, app_browser->tab_count()); |
60 | 61 |
61 // The normal browser should now have three. | 62 // The normal browser should now have three. |
62 EXPECT_EQ(3, browser()->tab_count()); | 63 EXPECT_EQ(3, browser()->tab_count()); |
63 | 64 |
64 // Open an app frame popup browser with a single blank foreground tab. | 65 // Open an app frame popup browser with a single blank foreground tab. |
65 Browser* app_popup_browser = | 66 Browser* app_popup_browser = |
66 browser()->CreateForApp(L"Test", browser()->profile(), false); | 67 browser()->CreateForApp(L"Test", browser()->profile(), false); |
67 app_popup_browser->AddBlankTab(true); | 68 app_popup_browser->AddBlankTab(true); |
68 EXPECT_EQ(1, app_popup_browser->tab_count()); | 69 EXPECT_EQ(1, app_popup_browser->tab_count()); |
69 | 70 |
70 // Now try opening another tab in the app popup browser. | 71 // Now try opening another tab in the app popup browser. |
71 app_popup_browser->AddTabWithURL(GURL("about:blank"), GURL(), | 72 app_popup_browser->AddTabWithURL(GURL(chrome::kAboutBlankURL), GURL(), |
72 PageTransition::TYPED, true, -1, NULL); | 73 PageTransition::TYPED, true, -1, NULL); |
73 | 74 |
74 // The popup should still only have one tab. | 75 // The popup should still only have one tab. |
75 EXPECT_EQ(1, app_popup_browser->tab_count()); | 76 EXPECT_EQ(1, app_popup_browser->tab_count()); |
76 | 77 |
77 // The normal browser should now have four. | 78 // The normal browser should now have four. |
78 EXPECT_EQ(4, browser()->tab_count()); | 79 EXPECT_EQ(4, browser()->tab_count()); |
79 | 80 |
80 // Close the additional browsers. | 81 // Close the additional browsers. |
81 popup_browser->CloseAllTabs(); | 82 popup_browser->CloseAllTabs(); |
82 app_browser->CloseAllTabs(); | 83 app_browser->CloseAllTabs(); |
83 app_popup_browser->CloseAllTabs(); | 84 app_popup_browser->CloseAllTabs(); |
84 } | 85 } |
85 */ | 86 */ |
OLD | NEW |