| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "base/values.h" | 8 #include "base/values.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/history/history_service_factory.h" | 10 #include "chrome/browser/history/history_service_factory.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 browser(), test_url, NEW_FOREGROUND_TAB, | 207 browser(), test_url, NEW_FOREGROUND_TAB, |
| 208 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 208 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
| 209 | 209 |
| 210 // Check that we got the interstitial. | 210 // Check that we got the interstitial. |
| 211 WebContents* tab = tab_strip->GetActiveWebContents(); | 211 WebContents* tab = tab_strip->GetActiveWebContents(); |
| 212 CheckShownPageIsInterstitial(tab); | 212 CheckShownPageIsInterstitial(tab); |
| 213 | 213 |
| 214 // On pressing the "back" button, the new tab should be closed, and we should | 214 // On pressing the "back" button, the new tab should be closed, and we should |
| 215 // get back to the previous active tab. | 215 // get back to the previous active tab. |
| 216 MockTabStripModelObserver observer(tab_strip); | 216 MockTabStripModelObserver observer(tab_strip); |
| 217 base::RunLoop run_loop; |
| 217 EXPECT_CALL(observer, | 218 EXPECT_CALL(observer, |
| 218 TabClosingAt(tab_strip, tab, tab_strip->active_index())); | 219 TabClosingAt(tab_strip, tab, tab_strip->active_index())) |
| 220 .WillOnce(testing::InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 219 GoBack(tab); | 221 GoBack(tab); |
| 222 run_loop.Run(); |
| 220 EXPECT_EQ(prev_tab, tab_strip->GetActiveWebContents()); | 223 EXPECT_EQ(prev_tab, tab_strip->GetActiveWebContents()); |
| 221 } | 224 } |
| 222 | 225 |
| 223 // Tests whether a visit attempt adds a special history entry. | 226 // Tests whether a visit attempt adds a special history entry. |
| 224 IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest, | 227 IN_PROC_BROWSER_TEST_F(SupervisedUserBlockModeTest, |
| 225 HistoryVisitRecorded) { | 228 HistoryVisitRecorded) { |
| 226 GURL allowed_url("http://www.example.com/files/simple.html"); | 229 GURL allowed_url("http://www.example.com/files/simple.html"); |
| 227 | 230 |
| 228 // Set the host as allowed. | 231 // Set the host as allowed. |
| 229 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); | 232 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 dict.PassAs<base::Value>()); | 306 dict.PassAs<base::Value>()); |
| 304 EXPECT_EQ( | 307 EXPECT_EQ( |
| 305 SupervisedUserService::MANUAL_ALLOW, | 308 SupervisedUserService::MANUAL_ALLOW, |
| 306 supervised_user_service_->GetManualBehaviorForHost(test_url.host())); | 309 supervised_user_service_->GetManualBehaviorForHost(test_url.host())); |
| 307 | 310 |
| 308 observer.Wait(); | 311 observer.Wait(); |
| 309 EXPECT_EQ(test_url, web_contents->GetURL()); | 312 EXPECT_EQ(test_url, web_contents->GetURL()); |
| 310 } | 313 } |
| 311 | 314 |
| 312 } // namespace | 315 } // namespace |
| OLD | NEW |