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" |
39 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 40 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
40 #include "chrome/common/chrome_notification_types.h" | 41 #include "chrome/common/chrome_notification_types.h" |
41 #include "chrome/common/chrome_switches.h" | 42 #include "chrome/common/chrome_switches.h" |
42 #include "chrome/common/extensions/extension.h" | 43 #include "chrome/common/extensions/extension.h" |
43 #include "chrome/common/url_constants.h" | 44 #include "chrome/common/url_constants.h" |
44 #include "chrome/test/base/in_process_browser_test.h" | 45 #include "chrome/test/base/in_process_browser_test.h" |
45 #include "chrome/test/base/ui_test_utils.h" | 46 #include "chrome/test/base/ui_test_utils.h" |
46 #include "content/public/browser/favicon_status.h" | 47 #include "content/public/browser/favicon_status.h" |
47 #include "content/public/browser/interstitial_page.h" | 48 #include "content/public/browser/interstitial_page.h" |
48 #include "content/public/browser/interstitial_page_delegate.h" | 49 #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()); | 892 ASSERT_TRUE(test_server()->Start()); |
892 | 893 |
893 // Load an app. | 894 // Load an app. |
894 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 895 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
895 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 896 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
896 const Extension* extension_app = GetExtension(); | 897 const Extension* extension_app = GetExtension(); |
897 | 898 |
898 CommandLine command_line(CommandLine::NO_PROGRAM); | 899 CommandLine command_line(CommandLine::NO_PROGRAM); |
899 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 900 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
900 | 901 |
901 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 902 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
902 StartupBrowserCreator::IS_FIRST_RUN : | 903 browser::startup::IS_FIRST_RUN : |
903 StartupBrowserCreator::IS_NOT_FIRST_RUN; | 904 browser::startup::IS_NOT_FIRST_RUN; |
904 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), command_line, | 905 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); |
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 StartupBrowserCreator::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 1255 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
1256 StartupBrowserCreator::IS_FIRST_RUN : | 1256 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; |
1257 StartupBrowserCreator::IS_NOT_FIRST_RUN; | 1257 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); |
1258 StartupBrowserCreator::LaunchWithProfile launch(FilePath(), dummy, first_run); | |
1259 launch.profile_ = browser()->profile(); | 1258 launch.profile_ = browser()->profile(); |
1260 launch.ProcessStartupURLs(std::vector<GURL>()); | 1259 launch.ProcessStartupURLs(std::vector<GURL>()); |
1261 | 1260 |
1262 // The launch should have created a new browser. | 1261 // The launch should have created a new browser. |
1263 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); | 1262 ASSERT_EQ(2u, BrowserList::GetBrowserCount(browser()->profile())); |
1264 | 1263 |
1265 // Find the new browser. | 1264 // Find the new browser. |
1266 Browser* new_browser = NULL; | 1265 Browser* new_browser = NULL; |
1267 for (BrowserList::const_iterator i = BrowserList::begin(); | 1266 for (BrowserList::const_iterator i = BrowserList::begin(); |
1268 i != BrowserList::end() && !new_browser; ++i) { | 1267 i != BrowserList::end() && !new_browser; ++i) { |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1902 command_line->AppendSwitchASCII(switches::kApp, url.spec()); | 1901 command_line->AppendSwitchASCII(switches::kApp, url.spec()); |
1903 } | 1902 } |
1904 }; | 1903 }; |
1905 | 1904 |
1906 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { | 1905 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { |
1907 // Test that an application browser window loads correctly. | 1906 // Test that an application browser window loads correctly. |
1908 | 1907 |
1909 // Verify the browser is in application mode. | 1908 // Verify the browser is in application mode. |
1910 EXPECT_TRUE(browser()->IsApplication()); | 1909 EXPECT_TRUE(browser()->IsApplication()); |
1911 } | 1910 } |
OLD | NEW |