| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class SiteInstanceTestBrowserClient : public TestContentBrowserClient { | 64 class SiteInstanceTestBrowserClient : public TestContentBrowserClient { |
| 65 public: | 65 public: |
| 66 SiteInstanceTestBrowserClient() | 66 SiteInstanceTestBrowserClient() |
| 67 : privileged_process_id_(-1) { | 67 : privileged_process_id_(-1) { |
| 68 WebUIControllerFactory::RegisterFactory(&factory_); | 68 WebUIControllerFactory::RegisterFactory(&factory_); |
| 69 } | 69 } |
| 70 | 70 |
| 71 ~SiteInstanceTestBrowserClient() { | 71 ~SiteInstanceTestBrowserClient() { |
| 72 WebUIControllerFactoryRegistry::UnregisterFactoryForTesting(&factory_); | 72 WebUIControllerFactory::UnregisterFactoryForTesting(&factory_); |
| 73 } | 73 } |
| 74 | 74 |
| 75 virtual bool IsSuitableHost(RenderProcessHost* process_host, | 75 virtual bool IsSuitableHost(RenderProcessHost* process_host, |
| 76 const GURL& site_url) OVERRIDE { | 76 const GURL& site_url) OVERRIDE { |
| 77 return (privileged_process_id_ == process_host->GetID()) == | 77 return (privileged_process_id_ == process_host->GetID()) == |
| 78 site_url.SchemeIs(kPrivilegedScheme); | 78 site_url.SchemeIs(kPrivilegedScheme); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void set_privileged_process_id(int process_id) { | 81 void set_privileged_process_id(int process_id) { |
| 82 privileged_process_id_ = process_id; | 82 privileged_process_id_ = process_id; |
| (...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); | 699 EXPECT_FALSE(instance->HasWrongProcessForURL(GURL("http://evernote.com"))); |
| 700 EXPECT_FALSE(instance->HasWrongProcessForURL( | 700 EXPECT_FALSE(instance->HasWrongProcessForURL( |
| 701 GURL("javascript:alert(document.location.href);"))); | 701 GURL("javascript:alert(document.location.href);"))); |
| 702 | 702 |
| 703 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings"))); | 703 EXPECT_TRUE(instance->HasWrongProcessForURL(GURL("chrome://settings"))); |
| 704 | 704 |
| 705 DrainMessageLoops(); | 705 DrainMessageLoops(); |
| 706 } | 706 } |
| 707 | 707 |
| 708 } // namespace content | 708 } // namespace content |
| OLD | NEW |