OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/sys_info.h" | 9 #include "base/sys_info.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 FilePath(kTitle1File))); | 299 FilePath(kTitle1File))); |
300 RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); | 300 RenderProcessHost::iterator it(RenderProcessHost::AllHostsIterator()); |
301 for (; !it.IsAtEnd(); it.Advance()) { | 301 for (; !it.IsAtEnd(); it.Advance()) { |
302 base::TimeDelta renderer_td = | 302 base::TimeDelta renderer_td = |
303 it.GetCurrentValue()->get_child_process_idle_time(); | 303 it.GetCurrentValue()->get_child_process_idle_time(); |
304 base::TimeDelta browser_td = base::TimeTicks::Now() - start; | 304 base::TimeDelta browser_td = base::TimeTicks::Now() - start; |
305 EXPECT_TRUE(browser_td >= renderer_td); | 305 EXPECT_TRUE(browser_td >= renderer_td); |
306 } | 306 } |
307 } | 307 } |
308 | 308 |
309 // Test IDC_CREATE_SHORTCUTS command is enabled for url scheme file, ftp, http | 309 // Test IDC_CREATE_SHORTCUTS command is enabled for url scheme file, ftp, http, |
310 // and https and disabled for chrome://, about:// etc. | 310 // https, and httpsv and disabled for chrome://, about:// etc. |
311 // TODO(pinkerton): Disable app-mode in the model until we implement it | 311 // TODO(pinkerton): Disable app-mode in the model until we implement it |
312 // on the Mac. http://crbug.com/13148 | 312 // on the Mac. http://crbug.com/13148 |
313 #if !defined(OS_MACOSX) | 313 #if !defined(OS_MACOSX) |
314 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFile) { | 314 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFile) { |
315 CommandUpdater* command_updater = browser()->command_updater(); | 315 CommandUpdater* command_updater = browser()->command_updater(); |
316 | 316 |
317 static const FilePath::CharType* kEmptyFile = FILE_PATH_LITERAL("empty.html"); | 317 static const FilePath::CharType* kEmptyFile = FILE_PATH_LITERAL("empty.html"); |
318 GURL file_url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), | 318 GURL file_url(ui_test_utils::GetTestUrl(FilePath(FilePath::kCurrentDirectory), |
319 FilePath(kEmptyFile))); | 319 FilePath(kEmptyFile))); |
320 ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); | 320 ASSERT_TRUE(file_url.SchemeIs(chrome::kFileScheme)); |
(...skipping 15 matching lines...) Expand all Loading... |
336 CommandUpdater* command_updater = browser()->command_updater(); | 336 CommandUpdater* command_updater = browser()->command_updater(); |
337 | 337 |
338 net::TestServer test_server(net::TestServer::TYPE_HTTPS, FilePath(kDocRoot)); | 338 net::TestServer test_server(net::TestServer::TYPE_HTTPS, FilePath(kDocRoot)); |
339 ASSERT_TRUE(test_server.Start()); | 339 ASSERT_TRUE(test_server.Start()); |
340 GURL https_url(test_server.GetURL("/")); | 340 GURL https_url(test_server.GetURL("/")); |
341 ASSERT_TRUE(https_url.SchemeIs(chrome::kHttpsScheme)); | 341 ASSERT_TRUE(https_url.SchemeIs(chrome::kHttpsScheme)); |
342 ui_test_utils::NavigateToURL(browser(), https_url); | 342 ui_test_utils::NavigateToURL(browser(), https_url); |
343 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 343 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
344 } | 344 } |
345 | 345 |
| 346 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutHttpsv) { |
| 347 CommandUpdater* command_updater = browser()->command_updater(); |
| 348 |
| 349 net::TestServer test_server(net::TestServer::TYPE_HTTPS, FilePath(kDocRoot)); |
| 350 ASSERT_TRUE(test_server.Start()); |
| 351 GURL https_url(test_server.GetURL("/")); |
| 352 GURL::Replacements replacements; |
| 353 replacements.SetSchemeStr("httpsv"); |
| 354 GURL httpsv_url = https_url.ReplaceComponents(replacements); |
| 355 ASSERT_TRUE(https_url.SchemeIs(chrome::kHttpsvScheme)); |
| 356 ui_test_utils::NavigateToURL(browser(), https_url); |
| 357 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
| 358 } |
| 359 |
346 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { | 360 IN_PROC_BROWSER_TEST_F(BrowserTest, CommandCreateAppShortcutFtp) { |
347 CommandUpdater* command_updater = browser()->command_updater(); | 361 CommandUpdater* command_updater = browser()->command_updater(); |
348 | 362 |
349 net::TestServer test_server(net::TestServer::TYPE_FTP, FilePath(kDocRoot)); | 363 net::TestServer test_server(net::TestServer::TYPE_FTP, FilePath(kDocRoot)); |
350 ASSERT_TRUE(test_server.Start()); | 364 ASSERT_TRUE(test_server.Start()); |
351 GURL ftp_url(test_server.GetURL("")); | 365 GURL ftp_url(test_server.GetURL("")); |
352 ASSERT_TRUE(ftp_url.SchemeIs(chrome::kFtpScheme)); | 366 ASSERT_TRUE(ftp_url.SchemeIs(chrome::kFtpScheme)); |
353 ui_test_utils::NavigateToURL(browser(), ftp_url); | 367 ui_test_utils::NavigateToURL(browser(), ftp_url); |
354 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); | 368 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_CREATE_SHORTCUTS)); |
355 } | 369 } |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
777 | 791 |
778 // The normal browser should now have four. | 792 // The normal browser should now have four. |
779 EXPECT_EQ(4, browser()->tab_count()); | 793 EXPECT_EQ(4, browser()->tab_count()); |
780 | 794 |
781 // Close the additional browsers. | 795 // Close the additional browsers. |
782 popup_browser->CloseAllTabs(); | 796 popup_browser->CloseAllTabs(); |
783 app_browser->CloseAllTabs(); | 797 app_browser->CloseAllTabs(); |
784 app_popup_browser->CloseAllTabs(); | 798 app_popup_browser->CloseAllTabs(); |
785 } | 799 } |
786 #endif | 800 #endif |
OLD | NEW |