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/ref_counted.h" | 5 #include "base/ref_counted.h" |
6 #include "chrome/browser/browser.h" | 6 #include "chrome/browser/browser.h" |
7 #include "chrome/browser/browser_list.h" | 7 #include "chrome/browser/browser_list.h" |
8 #include "chrome/browser/renderer_host/render_view_host.h" | 8 #include "chrome/browser/renderer_host/render_view_host.h" |
9 #include "chrome/browser/extensions/autoupdate_interceptor.h" | 9 #include "chrome/browser/extensions/autoupdate_interceptor.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 GURL feed_url = server->TestServerPage(kFeedPage); | 267 GURL feed_url = server->TestServerPage(kFeedPage); |
268 ui_test_utils::NavigateToURL(browser(), feed_url); | 268 ui_test_utils::NavigateToURL(browser(), feed_url); |
269 ASSERT_TRUE(WaitForPageActionCountChangeTo(1)); | 269 ASSERT_TRUE(WaitForPageActionCountChangeTo(1)); |
270 | 270 |
271 UnloadExtension(last_loaded_extension_id_); | 271 UnloadExtension(last_loaded_extension_id_); |
272 | 272 |
273 // Make sure the page action goes away when it's unloaded. | 273 // Make sure the page action goes away when it's unloaded. |
274 ASSERT_TRUE(WaitForPageActionCountChangeTo(0)); | 274 ASSERT_TRUE(WaitForPageActionCountChangeTo(0)); |
275 } | 275 } |
276 | 276 |
| 277 // Tests that we can load page actions in the Omnibox. |
| 278 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionRefreshCrash) { |
| 279 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
| 280 |
| 281 size_t size_before = service->extensions()->size(); |
| 282 |
| 283 FilePath base_path = test_data_dir_.AppendASCII("browsertest") |
| 284 .AppendASCII("crash_44415"); |
| 285 // Load extension A. |
| 286 ASSERT_TRUE(LoadExtension(base_path.AppendASCII("ExtA"))); |
| 287 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(1)); |
| 288 ASSERT_EQ(size_before + 1, service->extensions()->size()); |
| 289 Extension* extensionA = service->extensions()->at(size_before); |
| 290 |
| 291 // Load extension B. |
| 292 ASSERT_TRUE(LoadExtension(base_path.AppendASCII("ExtB"))); |
| 293 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(2)); |
| 294 ASSERT_EQ(size_before + 2, service->extensions()->size()); |
| 295 Extension* extensionB = service->extensions()->at(size_before + 1); |
| 296 |
| 297 ReloadExtension(extensionA->id()); |
| 298 // ExtensionA has changed, so refetch it. |
| 299 ASSERT_EQ(size_before + 2, service->extensions()->size()); |
| 300 extensionA = service->extensions()->at(size_before + 1); |
| 301 |
| 302 ReloadExtension(extensionB->id()); |
| 303 |
| 304 // This is where it would crash, before http://crbug.com/44415 was fixed. |
| 305 ReloadExtension(extensionA->id()); |
| 306 } |
| 307 |
277 // Makes sure that the RSS detects RSS feed links, even when rel tag contains | 308 // Makes sure that the RSS detects RSS feed links, even when rel tag contains |
278 // more than just "alternate". | 309 // more than just "alternate". |
279 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) { | 310 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, RSSMultiRelLink) { |
280 HTTPTestServer* server = StartHTTPServer(); | 311 HTTPTestServer* server = StartHTTPServer(); |
281 | 312 |
282 ASSERT_TRUE(LoadExtension( | 313 ASSERT_TRUE(LoadExtension( |
283 test_data_dir_.AppendASCII("subscribe_page_action"))); | 314 test_data_dir_.AppendASCII("subscribe_page_action"))); |
284 | 315 |
285 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); | 316 ASSERT_TRUE(WaitForPageActionVisibilityChangeTo(0)); |
286 | 317 |
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 | 795 |
765 // If the options page hasn't already come up, wait for it. | 796 // If the options page hasn't already come up, wait for it. |
766 if (tab_strip->count() == 1) { | 797 if (tab_strip->count() == 1) { |
767 ui_test_utils::WaitForNewTab(browser()); | 798 ui_test_utils::WaitForNewTab(browser()); |
768 } | 799 } |
769 ASSERT_EQ(2, tab_strip->count()); | 800 ASSERT_EQ(2, tab_strip->count()); |
770 | 801 |
771 EXPECT_EQ(extension->GetResourceURL("options.html"), | 802 EXPECT_EQ(extension->GetResourceURL("options.html"), |
772 tab_strip->GetTabContentsAt(1)->GetURL()); | 803 tab_strip->GetTabContentsAt(1)->GetURL()); |
773 } | 804 } |
OLD | NEW |