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 "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_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/process_map.h" | 9 #include "chrome/browser/extensions/process_map.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 ui_test_utils::WindowedNotificationObserver observer( | 38 ui_test_utils::WindowedNotificationObserver observer( |
39 content::NOTIFICATION_LOAD_STOP, | 39 content::NOTIFICATION_LOAD_STOP, |
40 content::NotificationService::AllSources()); | 40 content::NotificationService::AllSources()); |
41 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 41 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
42 opener_host, L"", L"window.open('" + UTF8ToWide(url.spec()) + L"');")); | 42 opener_host, L"", L"window.open('" + UTF8ToWide(url.spec()) + L"');")); |
43 | 43 |
44 // The above window.open call is not user-initiated, it will create | 44 // The above window.open call is not user-initiated, it will create |
45 // a popup window instead of a new tab in current window. | 45 // a popup window instead of a new tab in current window. |
46 // Now the active tab in last active window should be the new tab. | 46 // Now the active tab in last active window should be the new tab. |
47 Browser* last_active_browser = BrowserList::GetLastActive(); | 47 Browser* last_active_browser = BrowserList::GetLastActive(); |
48 EXPECT_TRUE(last_active_browser); | 48 ASSERT_TRUE(last_active_browser); |
49 WebContents* newtab = last_active_browser->GetSelectedWebContents(); | 49 WebContents* newtab = last_active_browser->GetSelectedWebContents(); |
50 EXPECT_TRUE(newtab); | 50 ASSERT_TRUE(newtab); |
51 observer.Wait(); | 51 observer.Wait(); |
52 EXPECT_EQ(url, newtab->GetController().GetLastCommittedEntry()->GetURL()); | 52 EXPECT_EQ(url, newtab->GetController().GetLastCommittedEntry()->GetURL()); |
53 if (newtab_process_should_equal_opener) | 53 if (newtab_process_should_equal_opener) |
54 EXPECT_EQ(opener_host->GetProcess(), newtab->GetRenderProcessHost()); | 54 EXPECT_EQ(opener_host->GetProcess(), newtab->GetRenderProcessHost()); |
55 else | 55 else |
56 EXPECT_NE(opener_host->GetProcess(), newtab->GetRenderProcessHost()); | 56 EXPECT_NE(opener_host->GetProcess(), newtab->GetRenderProcessHost()); |
57 } | 57 } |
58 | 58 |
59 // Simulates a page navigating itself to an URL, and waits for the navigation. | 59 // Simulates a page navigating itself to an URL, and waits for the navigation. |
60 static void NavigateTabHelper(WebContents* contents, const GURL& url) { | 60 static void NavigateTabHelper(WebContents* contents, const GURL& url) { |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
672 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> | 672 &browser()->GetSelectedTabContentsWrapper()->web_contents()-> |
673 GetController())); | 673 GetController())); |
674 browser()->Reload(CURRENT_TAB); | 674 browser()->Reload(CURRENT_TAB); |
675 observer.Wait(); | 675 observer.Wait(); |
676 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( | 676 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractBool( |
677 contents->GetRenderViewHost(), L"", | 677 contents->GetRenderViewHost(), L"", |
678 L"window.domAutomationController.send(chrome.app.isInstalled)", | 678 L"window.domAutomationController.send(chrome.app.isInstalled)", |
679 &is_installed)); | 679 &is_installed)); |
680 ASSERT_TRUE(is_installed); | 680 ASSERT_TRUE(is_installed); |
681 } | 681 } |
OLD | NEW |