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 "base/utf_string_conversions.h" | 5 #include "base/utf_string_conversions.h" |
6 #include "chrome/browser/extensions/extension_apitest.h" | 6 #include "chrome/browser/extensions/extension_apitest.h" |
7 #include "chrome/browser/extensions/extension_host.h" | 7 #include "chrome/browser/extensions/extension_host.h" |
8 #include "chrome/browser/extensions/extension_process_manager.h" | 8 #include "chrome/browser/extensions/extension_process_manager.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 TabContents* newtab = last_active_browser->GetSelectedTabContents(); | 331 TabContents* newtab = last_active_browser->GetSelectedTabContents(); |
332 EXPECT_TRUE(newtab); | 332 EXPECT_TRUE(newtab); |
333 if (!newtab->controller().GetLastCommittedEntry() || | 333 if (!newtab->controller().GetLastCommittedEntry() || |
334 newtab->controller().GetLastCommittedEntry()->url() != app_url) | 334 newtab->controller().GetLastCommittedEntry()->url() != app_url) |
335 ui_test_utils::WaitForNavigation(&newtab->controller()); | 335 ui_test_utils::WaitForNavigation(&newtab->controller()); |
336 | 336 |
337 // Popup window should be in the app's process. | 337 // Popup window should be in the app's process. |
338 EXPECT_TRUE(last_active_browser->GetTabContentsAt(0)->render_view_host()-> | 338 EXPECT_TRUE(last_active_browser->GetTabContentsAt(0)->render_view_host()-> |
339 process()->is_extension_process()); | 339 process()->is_extension_process()); |
340 } | 340 } |
| 341 |
| 342 IN_PROC_BROWSER_TEST_F(AppApiTest, ReloadAppAfterCrash) { |
| 343 host_resolver()->AddRule("*", "127.0.0.1"); |
| 344 ASSERT_TRUE(test_server()->Start()); |
| 345 |
| 346 ASSERT_TRUE(LoadExtension(test_data_dir_.AppendASCII("app_process"))); |
| 347 |
| 348 GURL base_url = GetTestBaseURL("app_process"); |
| 349 |
| 350 // Load the app, chrome.app.isInstalled should be true. |
| 351 ui_test_utils::NavigateToURL(browser(), base_url.Resolve("path1/empty.html")); |
| 352 TabContents* contents = browser()->GetTabContentsAt(0); |
| 353 EXPECT_TRUE(contents->render_view_host()->process()->is_extension_process()); |
| 354 bool is_installed = false; |
| 355 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 356 contents->render_view_host(), L"", |
| 357 L"window.domAutomationController.send(chrome.app.isInstalled)", |
| 358 &is_installed)); |
| 359 ASSERT_TRUE(is_installed); |
| 360 |
| 361 // Crash the tab and reload it, chrome.app.isInstalled should still be true. |
| 362 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); |
| 363 browser()->Reload(CURRENT_TAB); |
| 364 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); |
| 365 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
| 366 contents->render_view_host(), L"", |
| 367 L"window.domAutomationController.send(chrome.app.isInstalled)", |
| 368 &is_installed)); |
| 369 ASSERT_TRUE(is_installed); |
| 370 } |
OLD | NEW |