| 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 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 820 ASSERT_TRUE(test_server()->Start()); | 820 ASSERT_TRUE(test_server()->Start()); |
| 821 | 821 |
| 822 // Load an app. | 822 // Load an app. |
| 823 host_resolver()->AddRule("www.example.com", "127.0.0.1"); | 823 host_resolver()->AddRule("www.example.com", "127.0.0.1"); |
| 824 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); | 824 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app/"))); |
| 825 const Extension* extension_app = GetExtension(); | 825 const Extension* extension_app = GetExtension(); |
| 826 | 826 |
| 827 CommandLine command_line(CommandLine::NO_PROGRAM); | 827 CommandLine command_line(CommandLine::NO_PROGRAM); |
| 828 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); | 828 command_line.AppendSwitchASCII(switches::kAppId, extension_app->id()); |
| 829 | 829 |
| 830 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 830 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
| 831 browser::startup::IS_FIRST_RUN : | 831 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
| 832 browser::startup::IS_NOT_FIRST_RUN; | |
| 833 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); | 832 StartupBrowserCreatorImpl launch(FilePath(), command_line, first_run); |
| 834 ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile(), NULL)); | 833 ASSERT_TRUE(launch.OpenApplicationWindow(browser()->profile(), NULL)); |
| 835 | 834 |
| 836 // Check that the new browser has an app name. | 835 // Check that the new browser has an app name. |
| 837 // The launch should have created a new browser. | 836 // The launch should have created a new browser. |
| 838 ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); | 837 ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); |
| 839 | 838 |
| 840 // Find the new browser. | 839 // Find the new browser. |
| 841 Browser* new_browser = NULL; | 840 Browser* new_browser = NULL; |
| 842 for (BrowserList::const_iterator i = BrowserList::begin(); | 841 for (BrowserList::const_iterator i = BrowserList::begin(); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 925 // Add a pinned non-app tab. | 924 // Add a pinned non-app tab. |
| 926 chrome::NewTab(browser()); | 925 chrome::NewTab(browser()); |
| 927 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); | 926 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kAboutBlankURL)); |
| 928 model->SetTabPinned(2, true); | 927 model->SetTabPinned(2, true); |
| 929 | 928 |
| 930 // Write out the pinned tabs. | 929 // Write out the pinned tabs. |
| 931 PinnedTabCodec::WritePinnedTabs(browser()->profile()); | 930 PinnedTabCodec::WritePinnedTabs(browser()->profile()); |
| 932 | 931 |
| 933 // Simulate launching again. | 932 // Simulate launching again. |
| 934 CommandLine dummy(CommandLine::NO_PROGRAM); | 933 CommandLine dummy(CommandLine::NO_PROGRAM); |
| 935 browser::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? | 934 chrome::startup::IsFirstRun first_run = first_run::IsChromeFirstRun() ? |
| 936 browser::startup::IS_FIRST_RUN : browser::startup::IS_NOT_FIRST_RUN; | 935 chrome::startup::IS_FIRST_RUN : chrome::startup::IS_NOT_FIRST_RUN; |
| 937 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); | 936 StartupBrowserCreatorImpl launch(FilePath(), dummy, first_run); |
| 938 launch.profile_ = browser()->profile(); | 937 launch.profile_ = browser()->profile(); |
| 939 launch.ProcessStartupURLs(std::vector<GURL>()); | 938 launch.ProcessStartupURLs(std::vector<GURL>()); |
| 940 | 939 |
| 941 // The launch should have created a new browser. | 940 // The launch should have created a new browser. |
| 942 ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); | 941 ASSERT_EQ(2u, browser::GetBrowserCount(browser()->profile())); |
| 943 | 942 |
| 944 // Find the new browser. | 943 // Find the new browser. |
| 945 Browser* new_browser = NULL; | 944 Browser* new_browser = NULL; |
| 946 for (BrowserList::const_iterator i = BrowserList::begin(); | 945 for (BrowserList::const_iterator i = BrowserList::begin(); |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1583 command_line->AppendSwitchASCII(switches::kApp, url.spec()); | 1582 command_line->AppendSwitchASCII(switches::kApp, url.spec()); |
| 1584 } | 1583 } |
| 1585 }; | 1584 }; |
| 1586 | 1585 |
| 1587 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { | 1586 IN_PROC_BROWSER_TEST_F(AppModeTest, EnableAppModeTest) { |
| 1588 // Test that an application browser window loads correctly. | 1587 // Test that an application browser window loads correctly. |
| 1589 | 1588 |
| 1590 // Verify the browser is in application mode. | 1589 // Verify the browser is in application mode. |
| 1591 EXPECT_TRUE(browser()->IsApplication()); | 1590 EXPECT_TRUE(browser()->IsApplication()); |
| 1592 } | 1591 } |
| OLD | NEW |