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 18 matching lines...) Expand all Loading... |
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_list.h" | 33 #include "chrome/browser/ui/browser_list.h" |
34 #include "chrome/browser/ui/browser_navigator.h" | 34 #include "chrome/browser/ui/browser_navigator.h" |
35 #include "chrome/browser/ui/browser_window.h" | 35 #include "chrome/browser/ui/browser_window.h" |
36 #include "chrome/browser/ui/fullscreen_controller.h" | 36 #include "chrome/browser/ui/fullscreen_controller.h" |
37 #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" | 38 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
39 #include "chrome/browser/ui/startup/startup_browser_creator_impl.h" | |
40 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 39 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
41 #include "chrome/common/chrome_notification_types.h" | 40 #include "chrome/common/chrome_notification_types.h" |
42 #include "chrome/common/chrome_switches.h" | 41 #include "chrome/common/chrome_switches.h" |
43 #include "chrome/common/extensions/extension.h" | 42 #include "chrome/common/extensions/extension.h" |
44 #include "chrome/common/url_constants.h" | 43 #include "chrome/common/url_constants.h" |
45 #include "chrome/test/base/in_process_browser_test.h" | 44 #include "chrome/test/base/in_process_browser_test.h" |
46 #include "chrome/test/base/ui_test_utils.h" | 45 #include "chrome/test/base/ui_test_utils.h" |
47 #include "content/public/browser/favicon_status.h" | 46 #include "content/public/browser/favicon_status.h" |
48 #include "content/public/browser/interstitial_page.h" | 47 #include "content/public/browser/interstitial_page.h" |
49 #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... |
892 ASSERT_TRUE(test_server()->Start()); | 891 ASSERT_TRUE(test_server()->Start()); |
893 | 892 |
894 // Load an app. | 893 // Load an app. |
895 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 894 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
896 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 895 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
897 const Extension* extension_app = GetExtension(); | 896 const Extension* extension_app = GetExtension(); |
898 | 897 |
899 CommandLine command_line(CommandLine::NO_PROGRAM); | 898 CommandLine command_line(CommandLine::NO_PROGRAM); |
900 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 899 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
901 | 900 |
902 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 901 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
903 browser::startup::IS_FIRST_RUN : | 902 StartupBrowserCreator::IS_FIRST_RUN : |
904 browser::startup::IS_NOT_FIRST_RUN; | 903 StartupBrowserCreator::IS_NOT_FIRST_RUN; |
905 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); | 904 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line, |
| 905 first_run); |
906 ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile())); | 906 ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile())); |
907 | 907 |
908 // Check that the new browser has an app name. | 908 // Check that the new browser has an app name. |
909 // The launch should have created a new browser. | 909 // The launch should have created a new browser. |
910 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); | 910 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); |
911 | 911 |
912 // Find the new browser. | 912 // Find the new browser. |
913 Browser* new_browser = NULL; | 913 Browser* new_browser = NULL; |
914 for (BrowserList::const_iterator i = BrowserList::begin(); | 914 for (BrowserList::const_iterator i = BrowserList::begin(); |
915 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... |
1245 // Add a pinned non-app tab. | 1245 // Add a pinned non-app tab. |
1246 browser()->NewTab(); | 1246 browser()->NewTab(); |
1247 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); | 1247 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); |
1248 model->SetTabPinned(2, true); | 1248 model->SetTabPinned(2, true); |
1249 | 1249 |
1250 // Write out the pinned tabs. | 1250 // Write out the pinned tabs. |
1251 PinnedTabCodec::WritePinnedTabs(browser()->profile()); | 1251 PinnedTabCodec::WritePinnedTabs(browser()->profile()); |
1252 | 1252 |
1253 // Simulate launching again. | 1253 // Simulate launching again. |
1254 CommandLine dummy(CommandLine::NO_PROGRAM); | 1254 CommandLine dummy(CommandLine::NO_PROGRAM); |
1255 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 1255 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
1256 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; | 1256 StartupBrowserCreator::IS_FIRST_RUN : |
1257 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); | 1257 StartupBrowserCreator::IS_NOT_FIRST_RUN; |
| 1258 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run); |
1258 launch.profile_ = browser()->profile(); | 1259 launch.profile_ = browser()->profile(); |
1259 launch.ProcessStartupURLs(std::vector<GURL>()); | 1260 launch.ProcessStartupURLs(std::vector<GURL>()); |
1260 | 1261 |
1261 // The launch should have created a new browser. | 1262 // The launch should have created a new browser. |
1262 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); | 1263 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); |
1263 | 1264 |
1264 // Find the new browser. | 1265 // Find the new browser. |
1265 Browser* new_browser = NULL; | 1266 Browser* new_browser = NULL; |
1266 for (BrowserList::const_iterator i = BrowserList::begin(); | 1267 for (BrowserList::const_iterator i = BrowserList::begin(); |
1267 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... |
1901 command_line->AppendSwitchASCII(switches::kApp, url.spec()); | 1902 command_line->AppendSwitchASCII(switches::kApp, url.spec()); |
1902 } | 1903 } |
1903 }; | 1904 }; |
1904 | 1905 |
1905 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { | 1906 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { |
1906 // Test that an application browser window loads correctly. | 1907 // Test that an application browser window loads correctly. |
1907 | 1908 |
1908 // Verify the browser is in application mode. | 1909 // Verify the browser is in application mode. |
1909 EXPECT_TRUE(browser()->IsApplication()); | 1910 EXPECT_TRUE(browser()->IsApplication()); |
1910 } | 1911 } |
OLD | NEW |