| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/compiler_specific.h" | 6 #include "base/compiler_specific.h" |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/string16.h" | 8 #include "base/string16.h" |
| 9 #include "content/browser/browser_thread_impl.h" | 9 #include "content/browser/browser_thread_impl.h" |
| 10 #include "content/browser/browsing_instance.h" | 10 #include "content/browser/browsing_instance.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 class SiteInstanceTestBrowserClient : public TestContentBrowserClient { | 58 class SiteInstanceTestBrowserClient : public TestContentBrowserClient { |
| 59 public: | 59 public: |
| 60 SiteInstanceTestBrowserClient() | 60 SiteInstanceTestBrowserClient() |
| 61 : privileged_process_id_(-1) { | 61 : privileged_process_id_(-1) { |
| 62 WebUIControllerFactory::RegisterFactory(&factory_); | 62 WebUIControllerFactory::RegisterFactory(&factory_); |
| 63 } | 63 } |
| 64 | 64 |
| 65 ~SiteInstanceTestBrowserClient() { | 65 ~SiteInstanceTestBrowserClient() { |
| 66 WebUIControllerFactoryRegistry::UnregisterFactoryForTesting(&factory_); | 66 WebUIControllerFactory::UnregisterFactoryForTesting(&factory_); |
| 67 } | 67 } |
| 68 | 68 |
| 69 virtual bool IsSuitableHost(RenderProcessHost* process_host, | 69 virtual bool IsSuitableHost(RenderProcessHost* process_host, |
| 70 const GURL& site_url) OVERRIDE { | 70 const GURL& site_url) OVERRIDE { |
| 71 return (privileged_process_id_ == process_host->GetID()) == | 71 return (privileged_process_id_ == process_host->GetID()) == |
| 72 site_url.SchemeIs(kPrivilegedScheme); | 72 site_url.SchemeIs(kPrivilegedScheme); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void set_privileged_process_id(int process_id) { | 75 void set_privileged_process_id(int process_id) { |
| 76 privileged_process_id_ = process_id; | 76 privileged_process_id_ = process_id; |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); | 693 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); |
| 694 EXPECT_FALSE(instance->HasWrongProcessForURL( | 694 EXPECT_FALSE(instance->HasWrongProcessForURL( |
| 695 GURL("javascript:alert(document.location.href);"))); | 695 GURL("javascript:alert(document.location.href);"))); |
| 696 | 696 |
| 697 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings"))); | 697 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings"))); |
| 698 | 698 |
| 699 DrainMessageLoops(); | 699 DrainMessageLoops(); |
| 700 } | 700 } |
| 701 | 701 |
| 702 } // namespace content | 702 } // namespace content |
| OLD | NEW |