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

Unified Diff: chrome/browser/browser_init_browsertest.cc

Issue 160331: Ensure we have a valid profile when using BrowserInit::LaunchWithProfile::Ope... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698