OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 using base::ASCIIToUTF16; | 102 using base::ASCIIToUTF16; |
103 using content::InterstitialPage; | 103 using content::InterstitialPage; |
104 using content::HostZoomMap; | 104 using content::HostZoomMap; |
105 using content::NavigationController; | 105 using content::NavigationController; |
106 using content::NavigationEntry; | 106 using content::NavigationEntry; |
107 using content::OpenURLParams; | 107 using content::OpenURLParams; |
108 using content::Referrer; | 108 using content::Referrer; |
109 using content::WebContents; | 109 using content::WebContents; |
110 using content::WebContentsObserver; | 110 using content::WebContentsObserver; |
111 using extensions::Extension; | 111 using extensions::Extension; |
| 112 using extensions::UninstalledExtensionInfo; |
112 | 113 |
113 namespace { | 114 namespace { |
114 | 115 |
115 const char* kBeforeUnloadHTML = | 116 const char* kBeforeUnloadHTML = |
116 "<html><head><title>beforeunload</title></head><body>" | 117 "<html><head><title>beforeunload</title></head><body>" |
117 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" | 118 "<script>window.onbeforeunload=function(e){return 'foo'}</script>" |
118 "</body></html>"; | 119 "</body></html>"; |
119 | 120 |
120 const char* kOpenNewBeforeUnloadPage = | 121 const char* kOpenNewBeforeUnloadPage = |
121 "w=window.open(); w.onbeforeunload=function(e){return 'foo'};"; | 122 "w=window.open(); w.onbeforeunload=function(e){return 'foo'};"; |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1300 TabStripModel::ADD_NONE); | 1301 TabStripModel::ADD_NONE); |
1301 model->SetTabPinned(0, true); | 1302 model->SetTabPinned(0, true); |
1302 ui_test_utils::NavigateToURL(browser(), url); | 1303 ui_test_utils::NavigateToURL(browser(), url); |
1303 | 1304 |
1304 MockTabStripModelObserver observer; | 1305 MockTabStripModelObserver observer; |
1305 model->AddObserver(&observer); | 1306 model->AddObserver(&observer); |
1306 | 1307 |
1307 // Uninstall the extension and make sure TabClosing is sent. | 1308 // Uninstall the extension and make sure TabClosing is sent. |
1308 ExtensionService* service = extensions::ExtensionSystem::Get( | 1309 ExtensionService* service = extensions::ExtensionSystem::Get( |
1309 browser()->profile())->extension_service(); | 1310 browser()->profile())->extension_service(); |
1310 service->UninstallExtension(GetExtension()->id(), | 1311 service->UninstallExtension( |
1311 ExtensionService::UNINSTALL_REASON_FOR_TESTING, | 1312 GetExtension()->id(), UninstalledExtensionInfo::REASON_FOR_TESTING, NULL); |
1312 NULL); | |
1313 EXPECT_EQ(1, observer.closing_count()); | 1313 EXPECT_EQ(1, observer.closing_count()); |
1314 | 1314 |
1315 model->RemoveObserver(&observer); | 1315 model->RemoveObserver(&observer); |
1316 | 1316 |
1317 // There should only be one tab now. | 1317 // There should only be one tab now. |
1318 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 1318 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
1319 } | 1319 } |
1320 | 1320 |
1321 #if !defined(OS_MACOSX) | 1321 #if !defined(OS_MACOSX) |
1322 // Open with --app-id=<id>, and see that an app window opens. | 1322 // Open with --app-id=<id>, and see that an app window opens. |
(...skipping 1383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2706 #endif | 2706 #endif |
2707 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); | 2707 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); |
2708 EXPECT_EQ(exp_commit_size, wcv_commit_size2); | 2708 EXPECT_EQ(exp_commit_size, wcv_commit_size2); |
2709 gfx::Size exp_final_size(initial_wcv_size); | 2709 gfx::Size exp_final_size(initial_wcv_size); |
2710 exp_final_size.Enlarge(wcv_resize_insets.width(), | 2710 exp_final_size.Enlarge(wcv_resize_insets.width(), |
2711 wcv_resize_insets.height() + height_inset); | 2711 wcv_resize_insets.height() + height_inset); |
2712 EXPECT_EQ(exp_final_size, | 2712 EXPECT_EQ(exp_final_size, |
2713 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); | 2713 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); |
2714 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); | 2714 EXPECT_EQ(exp_final_size, web_contents->GetContainerBounds().size()); |
2715 } | 2715 } |
OLD | NEW |