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

Side by Side Diff: chrome/browser/managed_mode/managed_mode_resource_throttle_browsertest.cc

Issue 12887005: Show interstitial from ManagedModeNavigationObserver instead of ManagedModeResourceThrottle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 7 years, 9 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
« no previous file with comments | « chrome/browser/managed_mode/managed_mode_resource_throttle.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/managed_mode/managed_mode_resource_throttle.h" 5 #include "chrome/browser/managed_mode/managed_mode_resource_throttle.h"
6 6
7 #include "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "chrome/browser/managed_mode/managed_user_service.h" 8 #include "chrome/browser/managed_mode/managed_user_service.h"
9 #include "chrome/browser/managed_mode/managed_user_service_factory.h" 9 #include "chrome/browser/managed_mode/managed_user_service_factory.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 23 matching lines...) Expand all
34 ManagedUserService* managed_user_service_; 34 ManagedUserService* managed_user_service_;
35 }; 35 };
36 36
37 void ManagedModeResourceThrottleTest::SetUpOnMainThread() { 37 void ManagedModeResourceThrottleTest::SetUpOnMainThread() {
38 Profile* profile = browser()->profile(); 38 Profile* profile = browser()->profile();
39 managed_user_service_ = ManagedUserServiceFactory::GetForProfile(profile); 39 managed_user_service_ = ManagedUserServiceFactory::GetForProfile(profile);
40 profile->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, true); 40 profile->GetPrefs()->SetBoolean(prefs::kProfileIsManaged, true);
41 managed_user_service_->Init(); 41 managed_user_service_->Init();
42 } 42 }
43 43
44 // Tests that showing the blocking interstitial for a WebContents without a 44 // Tests that blocking a request for a WebContents without a
45 // ManagedModeNavigationObserver doesn't crash. 45 // ManagedModeNavigationObserver doesn't crash.
46 IN_PROC_BROWSER_TEST_F(ManagedModeResourceThrottleTest, NoNavigationObserver) { 46 IN_PROC_BROWSER_TEST_F(ManagedModeResourceThrottleTest, NoNavigationObserver) {
47 scoped_ptr<WebContents> web_contents( 47 scoped_ptr<WebContents> web_contents(
48 WebContents::Create(WebContents::CreateParams(browser()->profile()))); 48 WebContents::Create(WebContents::CreateParams(browser()->profile())));
49 NavigationController& controller = web_contents->GetController(); 49 NavigationController& controller = web_contents->GetController();
50 content::TestNavigationObserver observer( 50 content::TestNavigationObserver observer(
51 content::Source<NavigationController>(&controller), 1); 51 content::Source<NavigationController>(&controller), 1);
52 controller.LoadURL(GURL("http://www.example.com"), content::Referrer(), 52 controller.LoadURL(GURL("http://www.example.com"), content::Referrer(),
53 content::PAGE_TRANSITION_TYPED, std::string()); 53 content::PAGE_TRANSITION_TYPED, std::string());
54 observer.Wait(); 54 observer.Wait();
55 content::NavigationEntry* entry = controller.GetActiveEntry();
56 ASSERT_TRUE(entry);
57 EXPECT_EQ(content::PAGE_TYPE_INTERSTITIAL, entry->GetPageType());
58 } 55 }
OLDNEW
« no previous file with comments | « chrome/browser/managed_mode/managed_mode_resource_throttle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698