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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/path_service.h" | 13 #include "base/path_service.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/threading/thread_restrictions.h" |
17 #include "base/threading/thread_task_runner_handle.h" | 18 #include "base/threading/thread_task_runner_handle.h" |
18 #include "build/build_config.h" | 19 #include "build/build_config.h" |
19 #include "chrome/browser/chrome_notification_types.h" | 20 #include "chrome/browser/chrome_notification_types.h" |
20 #include "chrome/browser/ui/browser.h" | 21 #include "chrome/browser/ui/browser.h" |
21 #include "chrome/browser/ui/browser_commands.h" | 22 #include "chrome/browser/ui/browser_commands.h" |
22 #include "chrome/browser/ui/browser_navigator_params.h" | 23 #include "chrome/browser/ui/browser_navigator_params.h" |
23 #include "chrome/browser/ui/browser_tabstrip.h" | 24 #include "chrome/browser/ui/browser_tabstrip.h" |
24 #include "chrome/browser/ui/browser_window.h" | 25 #include "chrome/browser/ui/browser_window.h" |
25 #include "chrome/browser/ui/chrome_pages.h" | 26 #include "chrome/browser/ui/chrome_pages.h" |
26 #include "chrome/browser/ui/find_bar/find_bar_host_unittest_util.h" | 27 #include "chrome/browser/ui/find_bar/find_bar_host_unittest_util.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 content::NotificationService::AllSources())); | 173 content::NotificationService::AllSources())); |
173 } | 174 } |
174 } | 175 } |
175 } | 176 } |
176 }; | 177 }; |
177 | 178 |
178 // A test interstitial page with typical HTML contents. | 179 // A test interstitial page with typical HTML contents. |
179 class TestInterstitialPage : public content::InterstitialPageDelegate { | 180 class TestInterstitialPage : public content::InterstitialPageDelegate { |
180 public: | 181 public: |
181 explicit TestInterstitialPage(WebContents* tab) { | 182 explicit TestInterstitialPage(WebContents* tab) { |
| 183 base::ThreadRestrictions::ScopedAllowIO allow_io; |
182 base::FilePath file_path; | 184 base::FilePath file_path; |
183 bool success = PathService::Get(chrome::DIR_TEST_DATA, &file_path); | 185 bool success = PathService::Get(chrome::DIR_TEST_DATA, &file_path); |
184 EXPECT_TRUE(success); | 186 EXPECT_TRUE(success); |
185 file_path = file_path.AppendASCII("focus/typical_page.html"); | 187 file_path = file_path.AppendASCII("focus/typical_page.html"); |
186 success = base::ReadFileToString(file_path, &html_contents_); | 188 success = base::ReadFileToString(file_path, &html_contents_); |
187 EXPECT_TRUE(success); | 189 EXPECT_TRUE(success); |
188 interstitial_page_ = content::InterstitialPage::Create( | 190 interstitial_page_ = content::InterstitialPage::Create( |
189 tab, true, GURL("http://interstitial.com"), this); | 191 tab, true, GURL("http://interstitial.com"), this); |
190 | 192 |
191 // Show the interstitial and delay return until it has attached. | 193 // Show the interstitial and delay return until it has attached. |
(...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
765 // omnibox focus, since the navigation occurred in a different tab. Otherwise | 767 // omnibox focus, since the navigation occurred in a different tab. Otherwise |
766 // the focus may scroll the origin out of view, making a spoof possible. | 768 // the focus may scroll the origin out of view, making a spoof possible. |
767 const std::string go_back_script = "window.opener.history.back();"; | 769 const std::string go_back_script = "window.opener.history.back();"; |
768 content::TestNavigationObserver back_observer(opener_web_contents); | 770 content::TestNavigationObserver back_observer(opener_web_contents); |
769 ASSERT_TRUE(content::ExecuteScript(new_web_contents, go_back_script)); | 771 ASSERT_TRUE(content::ExecuteScript(new_web_contents, go_back_script)); |
770 back_observer.Wait(); | 772 back_observer.Wait(); |
771 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); | 773 EXPECT_FALSE(IsViewFocused(VIEW_ID_OMNIBOX)); |
772 } | 774 } |
773 | 775 |
774 } // namespace | 776 } // namespace |
OLD | NEW |