| 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 23 matching lines...) Expand all Loading... |
| 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 content::RenderFrameHost* render_frame_host, | 41 content::RenderFrameHost* render_frame_host, |
| 42 const GURL& validated_url, | 42 const GURL& validated_url, |
| 43 int error_code, | 43 int error_code, |
| 44 const base::string16& error_description) OVERRIDE { | 44 const base::string16& error_description) override { |
| 45 failed_load_ = true; | 45 failed_load_ = true; |
| 46 error_code_ = static_cast<net::Error>(error_code); | 46 error_code_ = static_cast<net::Error>(error_code); |
| 47 validated_url_ = validated_url; | 47 validated_url_ = validated_url; |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool failed_load() const { return failed_load_; } | 50 bool failed_load() const { return failed_load_; } |
| 51 net::Error error_code() const { return error_code_; } | 51 net::Error error_code() const { return error_code_; } |
| 52 const GURL& validated_url() const { return validated_url_; } | 52 const GURL& validated_url() const { return validated_url_; } |
| 53 | 53 |
| 54 private: | 54 private: |
| (...skipping 19 matching lines...) Expand all Loading... |
| 74 GURL url(kURLs[i]); | 74 GURL url(kURLs[i]); |
| 75 LoadFailObserver observer(contents); | 75 LoadFailObserver observer(contents); |
| 76 ui_test_utils::NavigateToURL(browser(), url); | 76 ui_test_utils::NavigateToURL(browser(), url); |
| 77 EXPECT_TRUE(observer.failed_load()); | 77 EXPECT_TRUE(observer.failed_load()); |
| 78 EXPECT_EQ(net::ERR_NOT_IMPLEMENTED, observer.error_code()); | 78 EXPECT_EQ(net::ERR_NOT_IMPLEMENTED, observer.error_code()); |
| 79 EXPECT_EQ(url, observer.validated_url()); | 79 EXPECT_EQ(url, observer.validated_url()); |
| 80 } | 80 } |
| 81 } | 81 } |
| 82 | 82 |
| 83 } // namespace | 83 } // namespace |
| OLD | NEW |