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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
12 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "chrome/browser/ui/browser_tabstrip.h" |
13 #include "chrome/browser/ui/browser_window.h" | 14 #include "chrome/browser/ui/browser_window.h" |
14 #include "chrome/common/chrome_paths.h" | 15 #include "chrome/common/chrome_paths.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 | 20 |
20 using content::WebContents; | 21 using content::WebContents; |
21 | 22 |
22 namespace { | 23 namespace { |
23 | 24 |
24 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("popup_blocker"); | 25 static const FilePath::CharType* kTestDir = FILE_PATH_LITERAL("popup_blocker"); |
25 | 26 |
26 typedef InProcessBrowserTest PopupBlockerBrowserTest; | 27 typedef InProcessBrowserTest PopupBlockerBrowserTest; |
27 | 28 |
28 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, PopupBlockedPostBlank) { | 29 IN_PROC_BROWSER_TEST_F(PopupBlockerBrowserTest, PopupBlockedPostBlank) { |
29 FilePath file_name(FILE_PATH_LITERAL("popup-blocked-to-post-blank.html")); | 30 FilePath file_name(FILE_PATH_LITERAL("popup-blocked-to-post-blank.html")); |
30 FilePath test_dir(kTestDir); | 31 FilePath test_dir(kTestDir); |
31 GURL url(ui_test_utils::GetTestUrl(test_dir, file_name)); | 32 GURL url(ui_test_utils::GetTestUrl(test_dir, file_name)); |
32 ui_test_utils::NavigateToURL(browser(), url); | 33 ui_test_utils::NavigateToURL(browser(), url); |
33 | 34 |
34 // If the popup blocker blocked the blank post, there should be only one | 35 // If the popup blocker blocked the blank post, there should be only one |
35 // tab in only one browser window and the URL of current tab must be equal | 36 // tab in only one browser window and the URL of current tab must be equal |
36 // to the original URL. | 37 // to the original URL. |
37 EXPECT_EQ(1u, browser::GetBrowserCount(browser()->profile())); | 38 EXPECT_EQ(1u, browser::GetBrowserCount(browser()->profile())); |
38 EXPECT_EQ(1, browser()->tab_count()); | 39 EXPECT_EQ(1, browser()->tab_count()); |
39 WebContents* cur_tab = browser()->GetActiveWebContents(); | 40 WebContents* cur_tab = chrome::GetActiveWebContents(browser()); |
40 ASSERT_TRUE(cur_tab); | 41 ASSERT_TRUE(cur_tab); |
41 EXPECT_EQ(url, cur_tab->GetURL()); | 42 EXPECT_EQ(url, cur_tab->GetURL()); |
42 } | 43 } |
43 | 44 |
44 } // namespace | 45 } // namespace |
OLD | NEW |