Chromium Code Reviews| Index: chrome/browser/browser_init_browsertest.cc |
| =================================================================== |
| --- chrome/browser/browser_init_browsertest.cc (revision 0) |
| +++ chrome/browser/browser_init_browsertest.cc (revision 0) |
| @@ -0,0 +1,42 @@ |
| +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
|
brettw
2009/08/07 16:39:41
s/2006-2008/2009
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "chrome/browser/browser.h" |
| +#include "chrome/browser/browser_init.h" |
| +#include "chrome/browser/browser_list.h" |
| +#include "chrome/browser/browser_window.h" |
| +#include "chrome/test/in_process_browser_test.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace { |
| + |
| +class BrowserInitTest : public InProcessBrowserTest { |
| + protected: |
|
brettw
2009/08/07 16:39:41
I would just delete this "protected" line.
|
| +}; |
| + |
| +// Test that when there is a popup as the active browser any requests to |
| +// BrowserInit::LaunchWithProfile::OpenURLsInBrowser don't crash because |
| +// there's no explicit profile given. |
| +IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenURLsPopup) { |
| + std::vector<GURL> urls; |
| + urls.push_back(GURL("http://www.google.com")); |
| + urls.push_back(GURL("http://dev.chromium.org")); |
| + |
| + Browser* popup = Browser::CreateForPopup(browser()->profile()); |
| + ASSERT_EQ(popup->type(), Browser::TYPE_POPUP); |
| + BrowserWindow* window = popup->window(); |
| + window->Activate(); |
| + Browser* frontmost = BrowserList::GetLastActive(); |
| + ASSERT_EQ(frontmost, popup); |
| + |
| + CommandLine dummy((std::wstring())); |
| + BrowserInit::LaunchWithProfile launch(std::wstring(), dummy); |
| + // This should create a new window, but re-use the profile from |popup|. If |
| + // it used a NULL or invalid profile, it would crash. |
| + launch.OpenURLsInBrowser(popup, false, urls); |
| + frontmost = BrowserList::GetLastActive(); |
| + ASSERT_NE(frontmost, popup); |
| +} |
| + |
| +} // namespace |
| Property changes on: chrome/browser/browser_init_browsertest.cc |
| ___________________________________________________________________ |
| Name: svn:eol-style |
| + LF |