OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
11 #endif | 11 #endif |
12 #include "base/sys_info.h" | 12 #include "base/sys_info.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "chrome/app/chrome_command_ids.h" | 14 #include "chrome/app/chrome_command_ids.h" |
15 #include "chrome/browser/defaults.h" | 15 #include "chrome/browser/defaults.h" |
16 #include "chrome/browser/extensions/extension_browsertest.h" | 16 #include "chrome/browser/extensions/extension_browsertest.h" |
17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
18 #include "chrome/browser/extensions/extension_tab_helper.h" | 18 #include "chrome/browser/extensions/extension_tab_helper.h" |
| 19 #include "chrome/browser/first_run/first_run.h" |
19 #include "chrome/browser/profiles/profile.h" | 20 #include "chrome/browser/profiles/profile.h" |
20 #include "chrome/browser/tabs/pinned_tab_codec.h" | 21 #include "chrome/browser/tabs/pinned_tab_codec.h" |
21 #include "chrome/browser/tabs/tab_strip_model.h" | 22 #include "chrome/browser/tabs/tab_strip_model.h" |
22 #include "chrome/browser/translate/translate_tab_helper.h" | 23 #include "chrome/browser/translate/translate_tab_helper.h" |
23 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 24 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
24 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" | 25 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" |
25 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 26 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
26 #include "chrome/browser/ui/browser.h" | 27 #include "chrome/browser/ui/browser.h" |
27 #include "chrome/browser/ui/browser_init.h" | 28 #include "chrome/browser/ui/browser_init.h" |
28 #include "chrome/browser/ui/browser_list.h" | 29 #include "chrome/browser/ui/browser_list.h" |
(...skipping 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 ASSERT_TRUE(test_server()->Start()); | 725 ASSERT_TRUE(test_server()->Start()); |
725 | 726 |
726 // Load an app. | 727 // Load an app. |
727 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 728 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
728 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 729 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
729 const Extension* extension_app = GetExtension(); | 730 const Extension* extension_app = GetExtension(); |
730 | 731 |
731 CommandLine command_line(CommandLine::NO_PROGRAM); | 732 CommandLine command_line(CommandLine::NO_PROGRAM); |
732 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 733 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
733 | 734 |
734 BrowserInit::LaunchWithProfile launch(FilePath(), command_line); | 735 BrowserInit::LaunchWithProfile launch( |
| 736 FilePath(), command_line, FirstRun::IsChromeFirstRun()); |
735 ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile())); | 737 ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile())); |
736 | 738 |
737 // Check that the new browser has an app name. | 739 // Check that the new browser has an app name. |
738 // The launch should have created a new browser. | 740 // The launch should have created a new browser. |
739 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); | 741 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); |
740 | 742 |
741 // Find the new browser. | 743 // Find the new browser. |
742 Browser* new_browser = NULL; | 744 Browser* new_browser = NULL; |
743 for (BrowserList::const_iterator i = BrowserList::begin(); | 745 for (BrowserList::const_iterator i = BrowserList::begin(); |
744 i != BrowserList::end() && !new_browser; ++i) { | 746 i != BrowserList::end() && !new_browser; ++i) { |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1138 | 1140 |
1139 // The normal browser should now have four. | 1141 // The normal browser should now have four. |
1140 EXPECT_EQ(4, browser()->tab_count()); | 1142 EXPECT_EQ(4, browser()->tab_count()); |
1141 | 1143 |
1142 // Close the additional browsers. | 1144 // Close the additional browsers. |
1143 popup_browser->CloseAllTabs(); | 1145 popup_browser->CloseAllTabs(); |
1144 app_browser->CloseAllTabs(); | 1146 app_browser->CloseAllTabs(); |
1145 app_popup_browser->CloseAllTabs(); | 1147 app_popup_browser->CloseAllTabs(); |
1146 } | 1148 } |
1147 #endif | 1149 #endif |
OLD | NEW |