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

Side by Side 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, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/browser_init.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
brettw 2009/08/07 16:39:41 s/2006-2008/2009
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/browser.h"
6 #include "chrome/browser/browser_init.h"
7 #include "chrome/browser/browser_list.h"
8 #include "chrome/browser/browser_window.h"
9 #include "chrome/test/in_process_browser_test.h"
10 #include "testing/gtest/include/gtest/gtest.h"
11
12 namespace {
13
14 class BrowserInitTest : public InProcessBrowserTest {
15 protected:
brettw 2009/08/07 16:39:41 I would just delete this "protected" line.
16 };
17
18 // Test that when there is a popup as the active browser any requests to
19 // BrowserInit::LaunchWithProfile::OpenURLsInBrowser don't crash because
20 // there's no explicit profile given.
21 IN_PROC_BROWSER_TEST_F(BrowserInitTest, OpenURLsPopup) {
22 std::vector<GURL> urls;
23 urls.push_back(GURL("http://www.google.com"));
24 urls.push_back(GURL("http://dev.chromium.org"));
25
26 Browser* popup = Browser::CreateForPopup(browser()->profile());
27 ASSERT_EQ(popup->type(), Browser::TYPE_POPUP);
28 BrowserWindow* window = popup->window();
29 window->Activate();
30 Browser* frontmost = BrowserList::GetLastActive();
31 ASSERT_EQ(frontmost, popup);
32
33 CommandLine dummy((std::wstring()));
34 BrowserInit::LaunchWithProfile launch(std::wstring(), dummy);
35 // This should create a new window, but re-use the profile from |popup|. If
36 // it used a NULL or invalid profile, it would crash.
37 launch.OpenURLsInBrowser(popup, false, urls);
38 frontmost = BrowserList::GetLastActive();
39 ASSERT_NE(frontmost, popup);
40 }
41
42 } // namespace
OLDNEW
« 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