| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 23 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 24 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 25 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
| 26 #include "chrome/browser/tabs/pinned_tab_codec.h" | 26 #include "chrome/browser/tabs/pinned_tab_codec.h" |
| 27 #include "chrome/browser/tabs/tab_strip_model.h" | 27 #include "chrome/browser/tabs/tab_strip_model.h" |
| 28 #include "chrome/browser/translate/translate_tab_helper.h" | 28 #include "chrome/browser/translate/translate_tab_helper.h" |
| 29 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 29 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
| 30 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" | 30 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" |
| 31 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 31 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
| 32 #include "chrome/browser/ui/browser.h" | 32 #include "chrome/browser/ui/browser.h" |
| 33 #include "chrome/browser/ui/browser_init.h" | |
| 34 #include "chrome/browser/ui/browser_list.h" | 33 #include "chrome/browser/ui/browser_list.h" |
| 35 #include "chrome/browser/ui/browser_navigator.h" | 34 #include "chrome/browser/ui/browser_navigator.h" |
| 36 #include "chrome/browser/ui/browser_window.h" | 35 #include "chrome/browser/ui/browser_window.h" |
| 37 #include "chrome/browser/ui/fullscreen_controller.h" | 36 #include "chrome/browser/ui/fullscreen_controller.h" |
| 38 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" | 37 #include "chrome/browser/ui/fullscreen_exit_bubble_type.h" |
| 38 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 39 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 39 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
| 40 #include "chrome/common/chrome_notification_types.h" | 40 #include "chrome/common/chrome_notification_types.h" |
| 41 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
| 42 #include "chrome/common/extensions/extension.h" | 42 #include "chrome/common/extensions/extension.h" |
| 43 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
| 44 #include "chrome/test/base/in_process_browser_test.h" | 44 #include "chrome/test/base/in_process_browser_test.h" |
| 45 #include "chrome/test/base/ui_test_utils.h" | 45 #include "chrome/test/base/ui_test_utils.h" |
| 46 #include "content/public/browser/favicon_status.h" | 46 #include "content/public/browser/favicon_status.h" |
| 47 #include "content/public/browser/interstitial_page.h" | 47 #include "content/public/browser/interstitial_page.h" |
| 48 #include "content/public/browser/interstitial_page_delegate.h" | 48 #include "content/public/browser/interstitial_page_delegate.h" |
| (...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 ASSERT_TRUE(test_server()->Start()); | 891 ASSERT_TRUE(test_server()->Start()); |
| 892 | 892 |
| 893 // Load an app. | 893 // Load an app. |
| 894 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 894 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
| 895 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 895 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
| 896 const Extension* extension_app = GetExtension(); | 896 const Extension* extension_app = GetExtension(); |
| 897 | 897 |
| 898 CommandLine command_line(CommandLine::NO_PROGRAM); | 898 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 899 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 899 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
| 900 | 900 |
| 901 BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 901 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
| 902 BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; | 902 StartupBrowserCreator::IS_FIRST_RUN : |
| 903 BrowserInit::LaunchWithProfile launch(FilePath(), command_line, first_run); | 903 StartupBrowserCreator::IS_NOT_FIRST_RUN; |
| 904 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line, |
| 905 first_run); |
| 904 ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile())); | 906 ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile())); |
| 905 | 907 |
| 906 // Check that the new browser has an app name. | 908 // Check that the new browser has an app name. |
| 907 // The launch should have created a new browser. | 909 // The launch should have created a new browser. |
| 908 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); | 910 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); |
| 909 | 911 |
| 910 // Find the new browser. | 912 // Find the new browser. |
| 911 Browser* new_browser = NULL; | 913 Browser* new_browser = NULL; |
| 912 for (BrowserList::const_iterator i = BrowserList::begin(); | 914 for (BrowserList::const_iterator i = BrowserList::begin(); |
| 913 i != BrowserList::end() && !new_browser; ++i) { | 915 i != BrowserList::end() && !new_browser; ++i) { |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1243 // Add a pinned non-app tab. | 1245 // Add a pinned non-app tab. |
| 1244 browser()->NewTab(); | 1246 browser()->NewTab(); |
| 1245 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); | 1247 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); |
| 1246 model->SetTabPinned(2, true); | 1248 model->SetTabPinned(2, true); |
| 1247 | 1249 |
| 1248 // Write out the pinned tabs. | 1250 // Write out the pinned tabs. |
| 1249 PinnedTabCodec::WritePinnedTabs(browser()->profile()); | 1251 PinnedTabCodec::WritePinnedTabs(browser()->profile()); |
| 1250 | 1252 |
| 1251 // Simulate launching again. | 1253 // Simulate launching again. |
| 1252 CommandLine dummy(CommandLine::NO_PROGRAM); | 1254 CommandLine dummy(CommandLine::NO_PROGRAM); |
| 1253 BrowserInit::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 1255 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
| 1254 BrowserInit::IS_FIRST_RUN : BrowserInit::IS_NOT_FIRST_RUN; | 1256 StartupBrowserCreator::IS_FIRST_RUN : |
| 1255 BrowserInit::LaunchWithProfile launch(FilePath(), dummy, first_run); | 1257 StartupBrowserCreator::IS_NOT_FIRST_RUN; |
| 1258 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run); |
| 1256 launch.profile_ = browser()->profile(); | 1259 launch.profile_ = browser()->profile(); |
| 1257 launch.ProcessStartupURLs(std::vector<GURL>()); | 1260 launch.ProcessStartupURLs(std::vector<GURL>()); |
| 1258 | 1261 |
| 1259 // The launch should have created a new browser. | 1262 // The launch should have created a new browser. |
| 1260 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); | 1263 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); |
| 1261 | 1264 |
| 1262 // Find the new browser. | 1265 // Find the new browser. |
| 1263 Browser* new_browser = NULL; | 1266 Browser* new_browser = NULL; |
| 1264 for (BrowserList::const_iterator i = BrowserList::begin(); | 1267 for (BrowserList::const_iterator i = BrowserList::begin(); |
| 1265 i != BrowserList::end() && !new_browser; ++i) { | 1268 i != BrowserList::end() && !new_browser; ++i) { |
| (...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1899 command_line->AppendSwitchASCII(switches::kApp, url.spec()); | 1902 command_line->AppendSwitchASCII(switches::kApp, url.spec()); |
| 1900 } | 1903 } |
| 1901 }; | 1904 }; |
| 1902 | 1905 |
| 1903 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { | 1906 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { |
| 1904 // Test that an application browser window loads correctly. | 1907 // Test that an application browser window loads correctly. |
| 1905 | 1908 |
| 1906 // Verify the browser is in application mode. | 1909 // Verify the browser is in application mode. |
| 1907 EXPECT_TRUE(browser()->IsApplication()); | 1910 EXPECT_TRUE(browser()->IsApplication()); |
| 1908 } | 1911 } |
| OLD | NEW |