Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(17)

Side by Side Diff: chrome/browser/chromeos/offline/offline_load_page_unittest.cc

Issue 19869003: ChromeOS changes for GetURL refactor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing failing tests. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/network_library.h" 5 #include "chrome/browser/chromeos/cros/network_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/public/browser/interstitial_page.h" 8 #include "content/public/browser/interstitial_page.h"
9 #include "content/public/browser/navigation_controller.h" 9 #include "content/public/browser/navigation_controller.h"
10 #include "content/public/browser/web_contents.h" 10 #include "content/public/browser/web_contents.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 ASSERT_TRUE(interstitial); 107 ASSERT_TRUE(interstitial);
108 base::MessageLoop::current()->RunUntilIdle(); 108 base::MessageLoop::current()->RunUntilIdle();
109 109
110 // Simulate the user clicking "proceed". 110 // Simulate the user clicking "proceed".
111 interstitial->Proceed(); 111 interstitial->Proceed();
112 base::MessageLoop::current()->RunUntilIdle(); 112 base::MessageLoop::current()->RunUntilIdle();
113 113
114 EXPECT_EQ(OK, user_response()); 114 EXPECT_EQ(OK, user_response());
115 115
116 // The URL remains to be URL2. 116 // The URL remains to be URL2.
117 EXPECT_EQ(kURL2, web_contents()->GetURL().spec()); 117 EXPECT_EQ(kURL2, web_contents()->GetVisibleURL().spec());
118 118
119 // Commit navigation and the interstitial page is gone. 119 // Commit navigation and the interstitial page is gone.
120 Navigate(kURL2, 2); 120 Navigate(kURL2, 2);
121 EXPECT_FALSE(GetOfflineLoadPage()); 121 EXPECT_FALSE(GetOfflineLoadPage());
122 } 122 }
123 123
124 // Tests showing an offline page and not proceeding. 124 // Tests showing an offline page and not proceeding.
125 TEST_F(OfflineLoadPageTest, OfflinePageDontProceed) { 125 TEST_F(OfflineLoadPageTest, OfflinePageDontProceed) {
126 // Start a load. 126 // Start a load.
127 Navigate(kURL1, 1); 127 Navigate(kURL1, 1);
128 controller().LoadURL(GURL(kURL2), content::Referrer(), 128 controller().LoadURL(GURL(kURL2), content::Referrer(),
129 content::PAGE_TRANSITION_TYPED, std::string()); 129 content::PAGE_TRANSITION_TYPED, std::string());
130 130
131 // Simulate the load causing an offline interstitial page to be shown. 131 // Simulate the load causing an offline interstitial page to be shown.
132 ShowInterstitial(kURL2); 132 ShowInterstitial(kURL2);
133 InterstitialPage* interstitial = GetOfflineLoadPage(); 133 InterstitialPage* interstitial = GetOfflineLoadPage();
134 ASSERT_TRUE(interstitial); 134 ASSERT_TRUE(interstitial);
135 base::MessageLoop::current()->RunUntilIdle(); 135 base::MessageLoop::current()->RunUntilIdle();
136 136
137 // Simulate the user clicking "don't proceed". 137 // Simulate the user clicking "don't proceed".
138 interstitial->DontProceed(); 138 interstitial->DontProceed();
139 139
140 // The interstitial should be gone. 140 // The interstitial should be gone.
141 EXPECT_EQ(CANCEL, user_response()); 141 EXPECT_EQ(CANCEL, user_response());
142 EXPECT_FALSE(GetOfflineLoadPage()); 142 EXPECT_FALSE(GetOfflineLoadPage());
143 // We did not proceed, the pending entry should be gone. 143 // We did not proceed, the pending entry should be gone.
144 EXPECT_FALSE(controller().GetPendingEntry()); 144 EXPECT_FALSE(controller().GetPendingEntry());
145 // the URL is set back to kURL1. 145 // the URL is set back to kURL1.
146 EXPECT_EQ(kURL1, web_contents()->GetURL().spec()); 146 EXPECT_EQ(kURL1, web_contents()->GetLastCommittedURL().spec());
147 } 147 }
148 148
149 } // namespace chromeos 149 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698