OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
| 8 #include <memory> |
8 #include <set> | 9 #include <set> |
9 | 10 |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/json/json_reader.h" | 12 #include "base/json/json_reader.h" |
12 #include "base/location.h" | 13 #include "base/location.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/path_service.h" | 15 #include "base/path_service.h" |
15 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/string_split.h" | 17 #include "base/strings/string_split.h" |
17 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
(...skipping 13 matching lines...) Expand all Loading... |
31 #include "content/public/browser/navigation_controller.h" | 32 #include "content/public/browser/navigation_controller.h" |
32 #include "content/public/browser/navigation_entry.h" | 33 #include "content/public/browser/navigation_entry.h" |
33 #include "content/public/browser/render_process_host.h" | 34 #include "content/public/browser/render_process_host.h" |
34 #include "content/public/browser/resource_dispatcher_host.h" | 35 #include "content/public/browser/resource_dispatcher_host.h" |
35 #include "content/public/browser/web_contents.h" | 36 #include "content/public/browser/web_contents.h" |
36 #include "content/public/browser/web_contents_observer.h" | 37 #include "content/public/browser/web_contents_observer.h" |
37 #include "content/public/browser/web_ui_message_handler.h" | 38 #include "content/public/browser/web_ui_message_handler.h" |
38 #include "content/public/common/bindings_policy.h" | 39 #include "content/public/common/bindings_policy.h" |
39 #include "content/public/common/browser_side_navigation_policy.h" | 40 #include "content/public/common/browser_side_navigation_policy.h" |
40 #include "content/public/common/content_switches.h" | 41 #include "content/public/common/content_switches.h" |
41 #include "content/public/common/file_chooser_file_info.h" | |
42 #include "content/public/common/file_chooser_params.h" | |
43 #include "content/public/common/page_state.h" | 42 #include "content/public/common/page_state.h" |
44 #include "content/public/common/url_constants.h" | 43 #include "content/public/common/url_constants.h" |
45 #include "content/public/test/browser_test_utils.h" | 44 #include "content/public/test/browser_test_utils.h" |
46 #include "content/public/test/content_browser_test.h" | 45 #include "content/public/test/content_browser_test.h" |
47 #include "content/public/test/content_browser_test_utils.h" | 46 #include "content/public/test/content_browser_test_utils.h" |
48 #include "content/public/test/test_navigation_observer.h" | 47 #include "content/public/test/test_navigation_observer.h" |
49 #include "content/public/test/test_utils.h" | 48 #include "content/public/test/test_utils.h" |
50 #include "content/shell/browser/shell.h" | 49 #include "content/shell/browser/shell.h" |
51 #include "content/test/content_browser_test_utils_internal.h" | 50 #include "content/test/content_browser_test_utils_internal.h" |
52 #include "content/test/test_frame_navigation_observer.h" | 51 #include "content/test/test_frame_navigation_observer.h" |
(...skipping 1870 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1923 // the SwapOut ACK or a timeout. | 1922 // the SwapOut ACK or a timeout. |
1924 ASSERT_TRUE(rfh->IsRenderFrameLive()); | 1923 ASSERT_TRUE(rfh->IsRenderFrameLive()); |
1925 ASSERT_FALSE(rfh->is_active()); | 1924 ASSERT_FALSE(rfh->is_active()); |
1926 | 1925 |
1927 // We specifically want verify behavior between swap-out and RFH destruction. | 1926 // We specifically want verify behavior between swap-out and RFH destruction. |
1928 ASSERT_FALSE(rfh_observer.deleted()); | 1927 ASSERT_FALSE(rfh_observer.deleted()); |
1929 | 1928 |
1930 EXPECT_FALSE(handler->IsJavascriptAllowed()); | 1929 EXPECT_FALSE(handler->IsJavascriptAllowed()); |
1931 } | 1930 } |
1932 | 1931 |
1933 class FileChooserDelegate : public WebContentsDelegate { | |
1934 public: | |
1935 FileChooserDelegate(const base::FilePath& file) | |
1936 : file_(file), file_chosen_(false) {} | |
1937 | |
1938 void RunFileChooser(RenderFrameHost* render_frame_host, | |
1939 const FileChooserParams& params) override { | |
1940 // Send the selected file to the renderer process. | |
1941 FileChooserFileInfo file_info; | |
1942 file_info.file_path = file_; | |
1943 std::vector<FileChooserFileInfo> files; | |
1944 files.push_back(file_info); | |
1945 render_frame_host->FilesSelectedInChooser(files, FileChooserParams::Open); | |
1946 | |
1947 file_chosen_ = true; | |
1948 } | |
1949 | |
1950 bool file_chosen() { return file_chosen_; } | |
1951 | |
1952 private: | |
1953 base::FilePath file_; | |
1954 bool file_chosen_; | |
1955 }; | |
1956 | |
1957 // Test for http://crbug.com/262948. | 1932 // Test for http://crbug.com/262948. |
1958 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, | 1933 IN_PROC_BROWSER_TEST_F(RenderFrameHostManagerTest, |
1959 RestoreFileAccessForHistoryNavigation) { | 1934 RestoreFileAccessForHistoryNavigation) { |
1960 StartServer(); | 1935 StartServer(); |
1961 base::FilePath file; | 1936 base::FilePath file; |
1962 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file)); | 1937 EXPECT_TRUE(PathService::Get(base::DIR_TEMP, &file)); |
1963 file = file.AppendASCII("bar"); | 1938 file = file.AppendASCII("bar"); |
1964 | 1939 |
1965 // Navigate to url and get it to reference a file in its PageState. | 1940 // Navigate to url and get it to reference a file in its PageState. |
1966 GURL url1(embedded_test_server()->GetURL("/file_input.html")); | 1941 GURL url1(embedded_test_server()->GetURL("/file_input.html")); |
(...skipping 842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2809 TestNavigationObserver commit_observer(web_contents); | 2784 TestNavigationObserver commit_observer(web_contents); |
2810 shell()->LoadURL(embedded_test_server()->GetURL("b.com", "/title1.html")); | 2785 shell()->LoadURL(embedded_test_server()->GetURL("b.com", "/title1.html")); |
2811 commit_observer.Wait(); | 2786 commit_observer.Wait(); |
2812 exit_observer.Wait(); | 2787 exit_observer.Wait(); |
2813 | 2788 |
2814 // Ensure the entry's title hasn't changed after the ignored commit. | 2789 // Ensure the entry's title hasn't changed after the ignored commit. |
2815 EXPECT_EQ(title, entry->GetTitle()); | 2790 EXPECT_EQ(title, entry->GetTitle()); |
2816 } | 2791 } |
2817 | 2792 |
2818 } // namespace content | 2793 } // namespace content |
OLD | NEW |