OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 8 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // WebContents observer that can detect provisional load failures. | 32 // WebContents observer that can detect provisional load failures. |
33 class LoadFailObserver : public content::WebContentsObserver { | 33 class LoadFailObserver : public content::WebContentsObserver { |
34 public: | 34 public: |
35 explicit LoadFailObserver(content::WebContents* contents) | 35 explicit LoadFailObserver(content::WebContents* contents) |
36 : content::WebContentsObserver(contents), | 36 : content::WebContentsObserver(contents), |
37 failed_load_(false), | 37 failed_load_(false), |
38 error_code_(net::OK) { } | 38 error_code_(net::OK) { } |
39 | 39 |
40 virtual void DidFailProvisionalLoad( | 40 virtual void DidFailProvisionalLoad( |
41 int64 frame_id, | 41 int64 frame_id, |
42 const string16& frame_unique_name, | 42 const base::string16& frame_unique_name, |
43 bool is_main_frame, | 43 bool is_main_frame, |
44 const GURL& validated_url, | 44 const GURL& validated_url, |
45 int error_code, | 45 int error_code, |
46 const string16& error_description, | 46 const base::string16& error_description, |
47 content::RenderViewHost* render_view_host) OVERRIDE { | 47 content::RenderViewHost* render_view_host) OVERRIDE { |
48 failed_load_ = true; | 48 failed_load_ = true; |
49 error_code_ = static_cast<net::Error>(error_code); | 49 error_code_ = static_cast<net::Error>(error_code); |
50 validated_url_ = validated_url; | 50 validated_url_ = validated_url; |
51 } | 51 } |
52 | 52 |
53 bool failed_load() const { return failed_load_; } | 53 bool failed_load() const { return failed_load_; } |
54 net::Error error_code() const { return error_code_; } | 54 net::Error error_code() const { return error_code_; } |
55 const GURL& validated_url() const { return validated_url_; } | 55 const GURL& validated_url() const { return validated_url_; } |
56 | 56 |
(...skipping 20 matching lines...) Expand all Loading... |
77 GURL url(kURLs[i]); | 77 GURL url(kURLs[i]); |
78 LoadFailObserver observer(contents); | 78 LoadFailObserver observer(contents); |
79 ui_test_utils::NavigateToURL(browser(), url); | 79 ui_test_utils::NavigateToURL(browser(), url); |
80 EXPECT_TRUE(observer.failed_load()); | 80 EXPECT_TRUE(observer.failed_load()); |
81 EXPECT_EQ(net::ERR_NOT_IMPLEMENTED, observer.error_code()); | 81 EXPECT_EQ(net::ERR_NOT_IMPLEMENTED, observer.error_code()); |
82 EXPECT_EQ(url, observer.validated_url()); | 82 EXPECT_EQ(url, observer.validated_url()); |
83 } | 83 } |
84 } | 84 } |
85 | 85 |
86 } // namespace | 86 } // namespace |
OLD | NEW |