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 "chrome/browser/chromeos/cros/cros_library.h" | 5 #include "chrome/browser/chromeos/cros/cros_library.h" |
6 #include "chrome/browser/chromeos/offline/offline_load_page.h" | 6 #include "chrome/browser/chromeos/offline/offline_load_page.h" |
7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" | 7 #include "chrome/test/base/chrome_render_view_host_test_harness.h" |
| 8 #include "content/browser/tab_contents/interstitial_page.h" |
8 #include "content/browser/tab_contents/test_tab_contents.h" | 9 #include "content/browser/tab_contents/test_tab_contents.h" |
9 #include "content/test/test_browser_thread.h" | 10 #include "content/test/test_browser_thread.h" |
10 | 11 |
11 using content::BrowserThread; | 12 using content::BrowserThread; |
12 | 13 |
13 static const char* kURL1 = "http://www.google.com/"; | 14 static const char* kURL1 = "http://www.google.com/"; |
14 static const char* kURL2 = "http://www.gmail.com/"; | 15 static const char* kURL2 = "http://www.gmail.com/"; |
15 | 16 |
16 namespace chromeos { | 17 namespace chromeos { |
17 | 18 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 user_response_ = CANCEL; | 72 user_response_ = CANCEL; |
72 } | 73 } |
73 | 74 |
74 void Navigate(const char* url, int page_id) { | 75 void Navigate(const char* url, int page_id) { |
75 contents()->TestDidNavigate( | 76 contents()->TestDidNavigate( |
76 contents()->GetRenderViewHost(), page_id, GURL(url), | 77 contents()->GetRenderViewHost(), page_id, GURL(url), |
77 content::PAGE_TRANSITION_TYPED); | 78 content::PAGE_TRANSITION_TYPED); |
78 } | 79 } |
79 | 80 |
80 void ShowInterstitial(const char* url) { | 81 void ShowInterstitial(const char* url) { |
81 (new TestOfflineLoadPage(contents(), GURL(url), this))->Show(); | 82 new TestOfflineLoadPage(contents(), GURL(url), this); |
82 } | 83 } |
83 | 84 |
84 // Returns the OfflineLoadPage currently showing or NULL if none is | 85 // Returns the OfflineLoadPage currently showing or NULL if none is |
85 // showing. | 86 // showing. |
86 InterstitialPage* GetOfflineLoadPage() { | 87 InterstitialPage* GetOfflineLoadPage() { |
87 return InterstitialPage::GetInterstitialPage(contents()); | 88 return InterstitialPage::GetInterstitialPage(contents()); |
88 } | 89 } |
89 | 90 |
90 UserResponse user_response() const { return user_response_; } | 91 UserResponse user_response() const { return user_response_; } |
91 | 92 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // The interstitial should be gone. | 153 // The interstitial should be gone. |
153 EXPECT_EQ(CANCEL, user_response()); | 154 EXPECT_EQ(CANCEL, user_response()); |
154 EXPECT_FALSE(GetOfflineLoadPage()); | 155 EXPECT_FALSE(GetOfflineLoadPage()); |
155 // We did not proceed, the pending entry should be gone. | 156 // We did not proceed, the pending entry should be gone. |
156 EXPECT_FALSE(controller().GetPendingEntry()); | 157 EXPECT_FALSE(controller().GetPendingEntry()); |
157 // the URL is set back to kURL1. | 158 // the URL is set back to kURL1. |
158 EXPECT_EQ(kURL1, contents()->GetURL().spec()); | 159 EXPECT_EQ(kURL1, contents()->GetURL().spec()); |
159 } | 160 } |
160 | 161 |
161 } // namespace chromeos | 162 } // namespace chromeos |
OLD | NEW |