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 <string> | 5 #include <string> |
6 | 6 |
7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.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 #include "base/sys_info.h" | 10 #include "base/sys_info.h" |
11 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
12 #include "chrome/app/chrome_command_ids.h" | 12 #include "chrome/app/chrome_command_ids.h" |
13 #include "chrome/browser/defaults.h" | 13 #include "chrome/browser/defaults.h" |
14 #include "chrome/browser/extensions/extension_browsertest.h" | 14 #include "chrome/browser/extensions/extension_browsertest.h" |
15 #include "chrome/browser/extensions/extensions_service.h" | 15 #include "chrome/browser/extensions/extension_service.h" |
16 #include "chrome/browser/profiles/profile.h" | 16 #include "chrome/browser/profiles/profile.h" |
17 #include "chrome/browser/renderer_host/render_process_host.h" | 17 #include "chrome/browser/renderer_host/render_process_host.h" |
18 #include "chrome/browser/renderer_host/render_view_host.h" | 18 #include "chrome/browser/renderer_host/render_view_host.h" |
19 #include "chrome/browser/tab_contents/tab_contents.h" | 19 #include "chrome/browser/tab_contents/tab_contents.h" |
20 #include "chrome/browser/tabs/pinned_tab_codec.h" | 20 #include "chrome/browser/tabs/pinned_tab_codec.h" |
21 #include "chrome/browser/tabs/tab_strip_model.h" | 21 #include "chrome/browser/tabs/tab_strip_model.h" |
22 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" | 22 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" |
23 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" | 23 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" |
24 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" | 24 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" |
25 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 return page_title; | 154 return page_title; |
155 #else | 155 #else |
156 // Do we need to use the above code on POSIX as well? | 156 // Do we need to use the above code on POSIX as well? |
157 return page_title; | 157 return page_title; |
158 #endif | 158 #endif |
159 } | 159 } |
160 | 160 |
161 // Returns the app extension aptly named "App Test". | 161 // Returns the app extension aptly named "App Test". |
162 const Extension* GetExtension() { | 162 const Extension* GetExtension() { |
163 const ExtensionList* extensions = | 163 const ExtensionList* extensions = |
164 browser()->profile()->GetExtensionsService()->extensions(); | 164 browser()->profile()->GetExtensionService()->extensions(); |
165 for (size_t i = 0; i < extensions->size(); ++i) { | 165 for (size_t i = 0; i < extensions->size(); ++i) { |
166 if ((*extensions)[i]->name() == "App Test") | 166 if ((*extensions)[i]->name() == "App Test") |
167 return (*extensions)[i]; | 167 return (*extensions)[i]; |
168 } | 168 } |
169 NOTREACHED(); | 169 NOTREACHED(); |
170 return NULL; | 170 return NULL; |
171 } | 171 } |
172 }; | 172 }; |
173 | 173 |
174 // Launch the app on a page with no title, check that the app title was set | 174 // Launch the app on a page with no title, check that the app title was set |
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 app_contents->tab_contents()->SetExtensionApp(extension_app); | 474 app_contents->tab_contents()->SetExtensionApp(extension_app); |
475 | 475 |
476 model->AddTabContents(app_contents, 0, 0, TabStripModel::ADD_NONE); | 476 model->AddTabContents(app_contents, 0, 0, TabStripModel::ADD_NONE); |
477 model->SetTabPinned(0, true); | 477 model->SetTabPinned(0, true); |
478 ui_test_utils::NavigateToURL(browser(), url); | 478 ui_test_utils::NavigateToURL(browser(), url); |
479 | 479 |
480 MockTabStripModelObserver observer; | 480 MockTabStripModelObserver observer; |
481 model->AddObserver(&observer); | 481 model->AddObserver(&observer); |
482 | 482 |
483 // Uninstall the extension and make sure TabClosing is sent. | 483 // Uninstall the extension and make sure TabClosing is sent. |
484 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 484 ExtensionService* service = browser()->profile()->GetExtensionService(); |
485 service->UninstallExtension(GetExtension()->id(), false); | 485 service->UninstallExtension(GetExtension()->id(), false); |
486 EXPECT_EQ(1, observer.closing_count()); | 486 EXPECT_EQ(1, observer.closing_count()); |
487 | 487 |
488 model->RemoveObserver(&observer); | 488 model->RemoveObserver(&observer); |
489 | 489 |
490 // There should only be one tab now. | 490 // There should only be one tab now. |
491 ASSERT_EQ(1, browser()->tab_count()); | 491 ASSERT_EQ(1, browser()->tab_count()); |
492 } | 492 } |
493 | 493 |
494 #if defined(OS_WIN) | 494 #if defined(OS_WIN) |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
730 | 730 |
731 // The normal browser should now have four. | 731 // The normal browser should now have four. |
732 EXPECT_EQ(4, browser()->tab_count()); | 732 EXPECT_EQ(4, browser()->tab_count()); |
733 | 733 |
734 // Close the additional browsers. | 734 // Close the additional browsers. |
735 popup_browser->CloseAllTabs(); | 735 popup_browser->CloseAllTabs(); |
736 app_browser->CloseAllTabs(); | 736 app_browser->CloseAllTabs(); |
737 app_popup_browser->CloseAllTabs(); | 737 app_popup_browser->CloseAllTabs(); |
738 } | 738 } |
739 #endif | 739 #endif |
OLD | NEW |