Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(606)

Side by Side Diff: chrome_frame/test/chrome_frame_unittests.cc

Issue 402079: Ensure that the renderer has focus when ChromeFrame navigates to a URL in IE ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/chrome_frame_plugin.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include <windows.h> 4 #include <windows.h>
5 #include <stdarg.h> 5 #include <stdarg.h>
6 6
7 // IShellWindows includes. Unfortunately we can't keep these in 7 // IShellWindows includes. Unfortunately we can't keep these in
8 // alphabetic order since exdisp will bark if some interfaces aren't fully 8 // alphabetic order since exdisp will bark if some interfaces aren't fully
9 // defined. 9 // defined.
10 #include <mshtml.h> 10 #include <mshtml.h>
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); 94 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL);
95 base::KillProcesses(chrome_frame_test::kFirefoxImageName, 0, NULL); 95 base::KillProcesses(chrome_frame_test::kFirefoxImageName, 0, NULL);
96 base::KillProcesses(chrome_frame_test::kSafariImageName, 0, NULL); 96 base::KillProcesses(chrome_frame_test::kSafariImageName, 0, NULL);
97 base::KillProcesses(chrome_frame_test::kChromeImageName, 0, NULL); 97 base::KillProcesses(chrome_frame_test::kChromeImageName, 0, NULL);
98 98
99 server_.TearDown(); 99 server_.TearDown();
100 } 100 }
101 101
102 bool ChromeFrameTestWithWebServer::LaunchBrowser(BrowserKind browser, 102 bool ChromeFrameTestWithWebServer::LaunchBrowser(BrowserKind browser,
103 const wchar_t* page) { 103 const wchar_t* page) {
104 std::wstring url = UTF8ToWide(server_.Resolve(page).spec()); 104 std::wstring url = page;
105 if (url.find(L"files/") != std::wstring::npos)
106 url = UTF8ToWide(server_.Resolve(page).spec());
107
105 browser_ = browser; 108 browser_ = browser;
106 if (browser == IE) { 109 if (browser == IE) {
107 browser_handle_.Set(chrome_frame_test::LaunchIE(url)); 110 browser_handle_.Set(chrome_frame_test::LaunchIE(url));
108 } else if (browser == FIREFOX) { 111 } else if (browser == FIREFOX) {
109 browser_handle_.Set(chrome_frame_test::LaunchFirefox(url)); 112 browser_handle_.Set(chrome_frame_test::LaunchFirefox(url));
110 } else if (browser == OPERA) { 113 } else if (browser == OPERA) {
111 browser_handle_.Set(chrome_frame_test::LaunchOpera(url)); 114 browser_handle_.Set(chrome_frame_test::LaunchOpera(url));
112 } else if (browser == SAFARI) { 115 } else if (browser == SAFARI) {
113 browser_handle_.Set(chrome_frame_test::LaunchSafari(url)); 116 browser_handle_.Set(chrome_frame_test::LaunchSafari(url));
114 } else if (browser == CHROME) { 117 } else if (browser == CHROME) {
(...skipping 1619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1734 return; 1737 return;
1735 1738
1736 ASSERT_TRUE(mock.web_browser2() != NULL); 1739 ASSERT_TRUE(mock.web_browser2() != NULL);
1737 1740
1738 loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds); 1741 loop.RunFor(kChromeFrameLongNavigationTimeoutInSeconds);
1739 1742
1740 mock.Uninitialize(); 1743 mock.Uninitialize();
1741 chrome_frame_test::CloseAllIEWindows(); 1744 chrome_frame_test::CloseAllIEWindows();
1742 } 1745 }
1743 1746
1747 const wchar_t kChromeFrameAboutBlankUrl[] = L"cf:about:blank";
1748
1749 TEST_F(ChromeFrameTestWithWebServer, FullTabModeIE_ChromeFrameFocusTest) {
1750 TimedMsgLoop loop;
1751
1752 ASSERT_TRUE(LaunchBrowser(IE, kChromeFrameAboutBlankUrl));
1753
1754 // Allow some time for chrome to be launched.
1755 loop.RunFor(kChromeFrameLaunchDelay);
1756
1757 HWND renderer_window = chrome_frame_test::GetChromeRendererWindow();
1758 EXPECT_TRUE(IsWindow(renderer_window));
1759
1760 DWORD renderer_thread_id = 0;
1761 DWORD renderer_process_id = 0;
1762 renderer_thread_id = GetWindowThreadProcessId(renderer_window,
1763 &renderer_process_id);
1764
1765 AttachThreadInput(GetCurrentThreadId(), renderer_thread_id, TRUE);
1766 HWND focus_window = GetFocus();
1767 EXPECT_TRUE(focus_window == renderer_window);
1768 AttachThreadInput(GetCurrentThreadId(), renderer_thread_id, FALSE);
1769
1770 chrome_frame_test::CloseAllIEWindows();
1771 }
1772
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame_plugin.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698