| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 #include "apps/shell_window_registry.h" | 146 #include "apps/shell_window_registry.h" |
| 147 #include "apps/ui/native_app_window.h" | 147 #include "apps/ui/native_app_window.h" |
| 148 #include "base/basictypes.h" | 148 #include "base/basictypes.h" |
| 149 #include "base/compiler_specific.h" | 149 #include "base/compiler_specific.h" |
| 150 #include "chrome/browser/ui/extensions/application_launch.h" | 150 #include "chrome/browser/ui/extensions/application_launch.h" |
| 151 #include "ui/base/window_open_disposition.h" | 151 #include "ui/base/window_open_disposition.h" |
| 152 #endif | 152 #endif |
| 153 | 153 |
| 154 using content::BrowserThread; | 154 using content::BrowserThread; |
| 155 using content::URLRequestMockHTTPJob; | 155 using content::URLRequestMockHTTPJob; |
| 156 using testing::AnyNumber; | |
| 157 using testing::Mock; | 156 using testing::Mock; |
| 158 using testing::Return; | 157 using testing::Return; |
| 159 using testing::_; | 158 using testing::_; |
| 160 | 159 |
| 161 namespace policy { | 160 namespace policy { |
| 162 | 161 |
| 163 namespace { | 162 namespace { |
| 164 | 163 |
| 165 #if defined(OS_CHROMEOS) | 164 #if defined(OS_CHROMEOS) |
| 166 const int kOneHourInMs = 60 * 60 * 1000; | 165 const int kOneHourInMs = 60 * 60 * 1000; |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 579 |
| 581 class PolicyTest : public InProcessBrowserTest { | 580 class PolicyTest : public InProcessBrowserTest { |
| 582 protected: | 581 protected: |
| 583 PolicyTest() {} | 582 PolicyTest() {} |
| 584 virtual ~PolicyTest() {} | 583 virtual ~PolicyTest() {} |
| 585 | 584 |
| 586 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 585 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 587 CommandLine::ForCurrentProcess()->AppendSwitch("noerrdialogs"); | 586 CommandLine::ForCurrentProcess()->AppendSwitch("noerrdialogs"); |
| 588 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 587 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
| 589 .WillRepeatedly(Return(true)); | 588 .WillRepeatedly(Return(true)); |
| 590 EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber()); | |
| 591 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 589 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
| 592 } | 590 } |
| 593 | 591 |
| 594 virtual void SetUpOnMainThread() OVERRIDE { | 592 virtual void SetUpOnMainThread() OVERRIDE { |
| 595 BrowserThread::PostTask( | 593 BrowserThread::PostTask( |
| 596 BrowserThread::IO, FROM_HERE, | 594 BrowserThread::IO, FROM_HERE, |
| 597 base::Bind(chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 595 base::Bind(chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
| 598 } | 596 } |
| 599 | 597 |
| 600 // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA | 598 // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA |
| (...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2832 chrome_variations::VariationsService::GetVariationsServerURL( | 2830 chrome_variations::VariationsService::GetVariationsServerURL( |
| 2833 g_browser_process->local_state()); | 2831 g_browser_process->local_state()); |
| 2834 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); | 2832 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); |
| 2835 std::string value; | 2833 std::string value; |
| 2836 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 2834 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
| 2837 EXPECT_EQ("restricted", value); | 2835 EXPECT_EQ("restricted", value); |
| 2838 } | 2836 } |
| 2839 #endif | 2837 #endif |
| 2840 | 2838 |
| 2841 } // namespace policy | 2839 } // namespace policy |
| OLD | NEW |