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 "content/browser/site_per_process_browsertest.h" | 5 #include "content/browser/site_per_process_browsertest.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
9 #include "content/browser/frame_host/cross_process_frame_connector.h" | 9 #include "content/browser/frame_host/cross_process_frame_connector.h" |
10 #include "content/browser/frame_host/frame_tree.h" | 10 #include "content/browser/frame_host/frame_tree.h" |
(...skipping 20 matching lines...) Expand all Loading... |
31 public: | 31 public: |
32 explicit SitePerProcessWebContentsObserver(WebContents* web_contents) | 32 explicit SitePerProcessWebContentsObserver(WebContents* web_contents) |
33 : WebContentsObserver(web_contents), | 33 : WebContentsObserver(web_contents), |
34 navigation_succeeded_(false) {} | 34 navigation_succeeded_(false) {} |
35 virtual ~SitePerProcessWebContentsObserver() {} | 35 virtual ~SitePerProcessWebContentsObserver() {} |
36 | 36 |
37 virtual void DidStartProvisionalLoadForFrame( | 37 virtual void DidStartProvisionalLoadForFrame( |
38 RenderFrameHost* render_frame_host, | 38 RenderFrameHost* render_frame_host, |
39 const GURL& validated_url, | 39 const GURL& validated_url, |
40 bool is_error_page, | 40 bool is_error_page, |
41 bool is_iframe_srcdoc) OVERRIDE { | 41 bool is_iframe_srcdoc) override { |
42 navigation_succeeded_ = false; | 42 navigation_succeeded_ = false; |
43 } | 43 } |
44 | 44 |
45 virtual void DidFailProvisionalLoad( | 45 virtual void DidFailProvisionalLoad( |
46 RenderFrameHost* render_frame_host, | 46 RenderFrameHost* render_frame_host, |
47 const GURL& validated_url, | 47 const GURL& validated_url, |
48 int error_code, | 48 int error_code, |
49 const base::string16& error_description) OVERRIDE { | 49 const base::string16& error_description) override { |
50 navigation_url_ = validated_url; | 50 navigation_url_ = validated_url; |
51 navigation_succeeded_ = false; | 51 navigation_succeeded_ = false; |
52 } | 52 } |
53 | 53 |
54 virtual void DidCommitProvisionalLoadForFrame( | 54 virtual void DidCommitProvisionalLoadForFrame( |
55 RenderFrameHost* render_frame_host, | 55 RenderFrameHost* render_frame_host, |
56 const GURL& url, | 56 const GURL& url, |
57 ui::PageTransition transition_type) OVERRIDE { | 57 ui::PageTransition transition_type) override { |
58 navigation_url_ = url; | 58 navigation_url_ = url; |
59 navigation_succeeded_ = true; | 59 navigation_succeeded_ = true; |
60 } | 60 } |
61 | 61 |
62 const GURL& navigation_url() const { | 62 const GURL& navigation_url() const { |
63 return navigation_url_; | 63 return navigation_url_; |
64 } | 64 } |
65 | 65 |
66 int navigation_succeeded() const { return navigation_succeeded_; } | 66 int navigation_succeeded() const { return navigation_succeeded_; } |
67 | 67 |
(...skipping 24 matching lines...) Expand all Loading... |
92 return source_; | 92 return source_; |
93 } | 93 } |
94 | 94 |
95 const NotificationDetails& details() const { | 95 const NotificationDetails& details() const { |
96 return details_; | 96 return details_; |
97 } | 97 } |
98 | 98 |
99 // NotificationObserver: | 99 // NotificationObserver: |
100 virtual void Observe(int type, | 100 virtual void Observe(int type, |
101 const NotificationSource& source, | 101 const NotificationSource& source, |
102 const NotificationDetails& details) OVERRIDE; | 102 const NotificationDetails& details) override; |
103 | 103 |
104 private: | 104 private: |
105 bool seen_; | 105 bool seen_; |
106 bool seen_twice_; | 106 bool seen_twice_; |
107 bool running_; | 107 bool running_; |
108 NotificationRegistrar registrar_; | 108 NotificationRegistrar registrar_; |
109 | 109 |
110 NotificationSource source_; | 110 NotificationSource source_; |
111 NotificationDetails details_; | 111 NotificationDetails details_; |
112 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 112 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
(...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 "server-redirect?" + client_redirect_http_url.spec())); | 642 "server-redirect?" + client_redirect_http_url.spec())); |
643 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test")); | 643 EXPECT_TRUE(NavigateIframeToURL(shell(), server_redirect_http_url, "test")); |
644 | 644 |
645 // DidFailProvisionalLoad when navigating to client_redirect_http_url. | 645 // DidFailProvisionalLoad when navigating to client_redirect_http_url. |
646 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); | 646 EXPECT_EQ(observer.navigation_url(), client_redirect_http_url); |
647 EXPECT_FALSE(observer.navigation_succeeded()); | 647 EXPECT_FALSE(observer.navigation_succeeded()); |
648 } | 648 } |
649 } | 649 } |
650 | 650 |
651 } // namespace content | 651 } // namespace content |
OLD | NEW |