| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/files/file_util.h" | 6 #include "base/files/file_util.h" |
| 7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 23 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 24 #include "chrome/browser/ui/view_ids.h" | 24 #include "chrome/browser/ui/view_ids.h" |
| 25 #include "chrome/common/chrome_paths.h" | 25 #include "chrome/common/chrome_paths.h" |
| 26 #include "chrome/common/url_constants.h" | 26 #include "chrome/common/url_constants.h" |
| 27 #include "chrome/test/base/in_process_browser_test.h" | 27 #include "chrome/test/base/in_process_browser_test.h" |
| 28 #include "chrome/test/base/interactive_test_utils.h" | 28 #include "chrome/test/base/interactive_test_utils.h" |
| 29 #include "chrome/test/base/ui_test_utils.h" | 29 #include "chrome/test/base/ui_test_utils.h" |
| 30 #include "content/public/browser/interstitial_page.h" | 30 #include "content/public/browser/interstitial_page.h" |
| 31 #include "content/public/browser/interstitial_page_delegate.h" | 31 #include "content/public/browser/interstitial_page_delegate.h" |
| 32 #include "content/public/browser/notification_service.h" | 32 #include "content/public/browser/notification_service.h" |
| 33 #include "content/public/browser/render_frame_host.h" |
| 33 #include "content/public/browser/render_view_host.h" | 34 #include "content/public/browser/render_view_host.h" |
| 34 #include "content/public/browser/render_widget_host_view.h" | 35 #include "content/public/browser/render_widget_host_view.h" |
| 35 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
| 36 #include "content/public/test/browser_test_utils.h" | 37 #include "content/public/test/browser_test_utils.h" |
| 37 #include "net/test/embedded_test_server/embedded_test_server.h" | 38 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 38 | 39 |
| 39 #if defined(OS_WIN) | 40 #if defined(OS_WIN) |
| 40 #include "base/win/windows_version.h" | 41 #include "base/win/windows_version.h" |
| 41 #endif | 42 #endif |
| 42 | 43 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 // Show the interstitial and delay return until it has attached. | 166 // Show the interstitial and delay return until it has attached. |
| 166 interstitial_page_->Show(); | 167 interstitial_page_->Show(); |
| 167 content::WaitForInterstitialAttach(tab); | 168 content::WaitForInterstitialAttach(tab); |
| 168 | 169 |
| 169 EXPECT_TRUE(tab->ShowingInterstitialPage()); | 170 EXPECT_TRUE(tab->ShowingInterstitialPage()); |
| 170 } | 171 } |
| 171 | 172 |
| 172 std::string GetHTMLContents() override { return html_contents_; } | 173 std::string GetHTMLContents() override { return html_contents_; } |
| 173 | 174 |
| 174 RenderViewHost* render_view_host() { | 175 RenderViewHost* render_view_host() { |
| 175 return interstitial_page_->GetRenderViewHostForTesting(); | 176 return interstitial_page_->GetMainFrame()->GetRenderViewHost(); |
| 176 } | 177 } |
| 177 | 178 |
| 178 void DontProceed() { interstitial_page_->DontProceed(); } | 179 void DontProceed() { interstitial_page_->DontProceed(); } |
| 179 | 180 |
| 180 bool HasFocus() { return render_view_host()->GetView()->HasFocus(); } | 181 bool HasFocus() { return render_view_host()->GetView()->HasFocus(); } |
| 181 | 182 |
| 182 private: | 183 private: |
| 183 std::string html_contents_; | 184 std::string html_contents_; |
| 184 content::InterstitialPage* interstitial_page_; // Owns this. | 185 content::InterstitialPage* interstitial_page_; // Owns this. |
| 185 DISALLOW_COPY_AND_ASSIGN(TestInterstitialPage); | 186 DISALLOW_COPY_AND_ASSIGN(TestInterstitialPage); |
| (...skipping 513 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 content::NOTIFICATION_NAV_ENTRY_COMMITTED, | 700 content::NOTIFICATION_NAV_ENTRY_COMMITTED, |
| 700 content::NotificationService::AllSources()); | 701 content::NotificationService::AllSources()); |
| 701 chrome::GoForward(browser(), CURRENT_TAB); | 702 chrome::GoForward(browser(), CURRENT_TAB); |
| 702 forward_nav_observer.Wait(); | 703 forward_nav_observer.Wait(); |
| 703 } | 704 } |
| 704 | 705 |
| 705 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); | 706 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
| 706 } | 707 } |
| 707 | 708 |
| 708 } // namespace | 709 } // namespace |
| OLD | NEW |