Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: chrome/browser/extensions/window_open_apitest.cc

Issue 3352009: Fix bug where window.open() with no feature string from (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: add license text Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/browser.h"
7 #include "chrome/browser/browser_list.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 8 #include "chrome/browser/extensions/extension_apitest.h"
9 #include "chrome/browser/tab_contents/tab_contents.h"
7 #include "chrome/common/chrome_switches.h" 10 #include "chrome/common/chrome_switches.h"
11 #include "chrome/test/ui_test_utils.h"
12 #include "net/base/mock_host_resolver.h"
8 13
9 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FLAKY_WindowOpen) { 14 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, FLAKY_WindowOpen) {
10 CommandLine::ForCurrentProcess()->AppendSwitch( 15 CommandLine::ForCurrentProcess()->AppendSwitch(
11 switches::kEnableExperimentalExtensionApis); 16 switches::kEnableExperimentalExtensionApis);
12 17
13 ResultCatcher catcher; 18 ResultCatcher catcher;
14 ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_ 19 ASSERT_TRUE(LoadExtensionIncognito(test_data_dir_
15 .AppendASCII("window_open").AppendASCII("spanning"))); 20 .AppendASCII("window_open").AppendASCII("spanning")));
16 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); 21 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
17 } 22 }
23
24 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PopupBlockingExtension) {
25 host_resolver()->AddRule("*", "127.0.0.1");
26 ASSERT_TRUE(test_server()->Start());
27
28 ResultCatcher catcher;
29 ASSERT_TRUE(LoadExtension(
30 test_data_dir_.AppendASCII("window_open").AppendASCII("popup_blocking")
31 .AppendASCII("extension")));
32 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
33 }
34
35 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, PopupBlockingHostedApp) {
36 host_resolver()->AddRule("*", "127.0.0.1");
37 ASSERT_TRUE(test_server()->Start());
38
39 ASSERT_TRUE(LoadExtension(
40 test_data_dir_.AppendASCII("window_open").AppendASCII("popup_blocking")
41 .AppendASCII("hosted_app")));
42
43 std::string app_base("http://a.com:1337/files/extensions/api_test/"
Erik does not do reviews 2010/09/09 17:33:44 you're apparently supposed to get the port from th
44 "window_open/popup_blocking/hosted_app/");
45
46 ui_test_utils::NavigateToURL(browser(), GURL(app_base + "open_tab.html"));
47 if (browser()->tab_count() != 2)
48 ui_test_utils::WaitForNewTab(browser());
49 ASSERT_EQ(2, browser()->tab_count());
50 EXPECT_EQ(app_base + "tab.html",
51 browser()->GetTabContentsAt(1)->GetURL().spec());
52
53 ui_test_utils::NavigateToURL(browser(), GURL(app_base + "open_popup.html"));
54 Browser* new_browser = NULL;
55 if (BrowserList::GetBrowserCount(browser()->profile()) == 2)
56 new_browser = BrowserList::GetLastActive();
57 else
58 new_browser = ui_test_utils::WaitForNewBrowser();
59
60 ASSERT_EQ(1, new_browser->tab_count());
61 EXPECT_EQ(app_base + "popup.html",
62 new_browser->GetTabContentsAt(0)->GetURL().spec());
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698