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

Side by Side Diff: chrome/browser/browser_focus_uitest.cc

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to LKGR. Created 8 years, 9 months 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
OLDNEW
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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 205
206 RenderViewHost* render_view_host() { 206 RenderViewHost* render_view_host() {
207 return interstitial_page_->GetRenderViewHostForTesting(); 207 return interstitial_page_->GetRenderViewHostForTesting();
208 } 208 }
209 209
210 void DontProceed() { 210 void DontProceed() {
211 interstitial_page_->DontProceed(); 211 interstitial_page_->DontProceed();
212 } 212 }
213 213
214 bool HasFocus() { 214 bool HasFocus() {
215 return render_view_host()->view()->HasFocus(); 215 return render_view_host()->GetView()->HasFocus();
216 } 216 }
217 217
218 private: 218 private:
219 std::string html_contents_; 219 std::string html_contents_;
220 InterstitialPage* interstitial_page_; // Owns us. 220 InterstitialPage* interstitial_page_; // Owns us.
221 }; 221 };
222 222
223 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, ClickingMovesFocus) { 223 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, ClickingMovesFocus) {
224 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 224 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
225 #if defined(OS_POSIX) 225 #if defined(OS_POSIX)
(...skipping 509 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 #endif 735 #endif
736 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 736 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
737 ASSERT_TRUE(test_server()->Start()); 737 ASSERT_TRUE(test_server()->Start());
738 738
739 // First we navigate to our test page. 739 // First we navigate to our test page.
740 GURL url = test_server()->GetURL(kSimplePage); 740 GURL url = test_server()->GetURL(kSimplePage);
741 ui_test_utils::NavigateToURL(browser(), url); 741 ui_test_utils::NavigateToURL(browser(), url);
742 742
743 // Page should have focus. 743 // Page should have focus.
744 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 744 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
745 EXPECT_TRUE(browser()->GetSelectedWebContents()->GetRenderViewHost()->view()-> 745 EXPECT_TRUE(browser()->GetSelectedWebContents()->GetRenderViewHost()->
746 HasFocus()); 746 GetView()->HasFocus());
747 747
748 // Let's show an interstitial. 748 // Let's show an interstitial.
749 TestInterstitialPage* interstitial_page = 749 TestInterstitialPage* interstitial_page =
750 new TestInterstitialPage(browser()->GetSelectedWebContents(), 750 new TestInterstitialPage(browser()->GetSelectedWebContents(),
751 true, GURL("http://interstitial.com")); 751 true, GURL("http://interstitial.com"));
752 // Give some time for the interstitial to show. 752 // Give some time for the interstitial to show.
753 MessageLoop::current()->PostDelayedTask(FROM_HERE, 753 MessageLoop::current()->PostDelayedTask(FROM_HERE,
754 MessageLoop::QuitClosure(), 754 MessageLoop::QuitClosure(),
755 1000); 755 1000);
756 ui_test_utils::RunMessageLoop(); 756 ui_test_utils::RunMessageLoop();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 browser()->Reload(CURRENT_TAB); 919 browser()->Reload(CURRENT_TAB);
920 observer.Wait(); 920 observer.Wait();
921 } 921 }
922 922
923 // Focus should now be on the tab contents. 923 // Focus should now be on the tab contents.
924 browser()->ShowDownloadsTab(); 924 browser()->ShowDownloadsTab();
925 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 925 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW));
926 } 926 }
927 927
928 } // namespace 928 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_manager_extension_api.cc ('k') | chrome/browser/chrome_content_browser_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698