| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/browser.h" | 8 #include "chrome/browser/browser.h" |
| 9 #include "chrome/browser/browser_init.h" | 9 #include "chrome/browser/browser_init.h" |
| 10 #include "chrome/browser/browser_list.h" | 10 #include "chrome/browser/browser_list.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 launch.OpenURLsInBrowser(popup, false, urls); | 58 launch.OpenURLsInBrowser(popup, false, urls); |
| 59 ASSERT_NE(popup, observer.added_browser_); | 59 ASSERT_NE(popup, observer.added_browser_); |
| 60 BrowserList::RemoveObserver(&observer); | 60 BrowserList::RemoveObserver(&observer); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Test that we prevent openning potentially dangerous schemes from the | 63 // Test that we prevent openning potentially dangerous schemes from the |
| 64 // command line. | 64 // command line. |
| 65 // TODO(jschuh): FLAKY because the process doesn't have sufficient time | 65 // TODO(jschuh): FLAKY because the process doesn't have sufficient time |
| 66 // to start on most BuildBot runs and I don't want to add longer delays to | 66 // to start on most BuildBot runs and I don't want to add longer delays to |
| 67 // the test. I'll circle back and make this work properly when i get a chance. | 67 // the test. I'll circle back and make this work properly when i get a chance. |
| 68 // See http://crbug.com/60026 |
| 68 IN_PROC_BROWSER_TEST_F(BrowserInitTest, FLAKY_BlockBadURLs) { | 69 IN_PROC_BROWSER_TEST_F(BrowserInitTest, FLAKY_BlockBadURLs) { |
| 69 const char* testurlstr = "http://localhost/"; | 70 const char* testurlstr = "http://localhost/"; |
| 70 const GURL testurl(testurlstr); | 71 const GURL testurl(testurlstr); |
| 71 CommandLine cmdline(CommandLine::NO_PROGRAM); | 72 CommandLine cmdline(CommandLine::NO_PROGRAM); |
| 72 cmdline.AppendArg(testurlstr); | 73 cmdline.AppendArg(testurlstr); |
| 73 cmdline.AppendArg("javascript:alert('boo')"); | 74 cmdline.AppendArg("javascript:alert('boo')"); |
| 74 cmdline.AppendArg(testurlstr); | 75 cmdline.AppendArg(testurlstr); |
| 75 cmdline.AppendArg("view-source:http://localhost/"); | 76 cmdline.AppendArg("view-source:http://localhost/"); |
| 76 | 77 |
| 77 // This will pick up the current browser instance. | 78 // This will pick up the current browser instance. |
| 78 BrowserInit::LaunchWithProfile launch(FilePath(), cmdline); | 79 BrowserInit::LaunchWithProfile launch(FilePath(), cmdline); |
| 79 launch.Launch(browser()->profile(), false); | 80 launch.Launch(browser()->profile(), false); |
| 80 | 81 |
| 81 // TODO(jschuh): Give the browser a chance to start first. | 82 // TODO(jschuh): Give the browser a chance to start first. |
| 82 PlatformThread::Sleep(50); | 83 PlatformThread::Sleep(50); |
| 83 | 84 |
| 84 // Skip about:blank in the first tab | 85 // Skip about:blank in the first tab |
| 85 for (int i = 1; i < browser()->tab_count(); i++) { | 86 for (int i = 1; i < browser()->tab_count(); i++) { |
| 86 const GURL &url = browser()->GetTabContentsAt(i)->GetURL(); | 87 const GURL &url = browser()->GetTabContentsAt(i)->GetURL(); |
| 87 ASSERT_EQ(url, testurl); | 88 ASSERT_EQ(url, testurl); |
| 88 } | 89 } |
| 89 ASSERT_EQ(browser()->tab_count(), 3); | 90 ASSERT_EQ(browser()->tab_count(), 3); |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace | 93 } // namespace |
| OLD | NEW |