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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
584 | 583 |
585 class PolicyTest : public InProcessBrowserTest { | 584 class PolicyTest : public InProcessBrowserTest { |
586 protected: | 585 protected: |
587 PolicyTest() {} | 586 PolicyTest() {} |
588 virtual ~PolicyTest() {} | 587 virtual ~PolicyTest() {} |
589 | 588 |
590 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 589 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
591 CommandLine::ForCurrentProcess()->AppendSwitch("noerrdialogs"); | 590 CommandLine::ForCurrentProcess()->AppendSwitch("noerrdialogs"); |
592 EXPECT_CALL(provider_, IsInitializationComplete(_)) | 591 EXPECT_CALL(provider_, IsInitializationComplete(_)) |
593 .WillRepeatedly(Return(true)); | 592 .WillRepeatedly(Return(true)); |
594 EXPECT_CALL(provider_, RegisterPolicyDomain(_)).Times(AnyNumber()); | |
595 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); | 593 BrowserPolicyConnector::SetPolicyProviderForTesting(&provider_); |
596 } | 594 } |
597 | 595 |
598 virtual void SetUpOnMainThread() OVERRIDE { | 596 virtual void SetUpOnMainThread() OVERRIDE { |
599 BrowserThread::PostTask( | 597 BrowserThread::PostTask( |
600 BrowserThread::IO, FROM_HERE, | 598 BrowserThread::IO, FROM_HERE, |
601 base::Bind(chrome_browser_net::SetUrlRequestMocksEnabled, true)); | 599 base::Bind(chrome_browser_net::SetUrlRequestMocksEnabled, true)); |
602 } | 600 } |
603 | 601 |
604 // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA | 602 // Makes URLRequestMockHTTPJobs serve data from content::DIR_TEST_DATA |
(...skipping 2231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2836 chrome_variations::VariationsService::GetVariationsServerURL( | 2834 chrome_variations::VariationsService::GetVariationsServerURL( |
2837 g_browser_process->local_state()); | 2835 g_browser_process->local_state()); |
2838 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); | 2836 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); |
2839 std::string value; | 2837 std::string value; |
2840 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 2838 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
2841 EXPECT_EQ("restricted", value); | 2839 EXPECT_EQ("restricted", value); |
2842 } | 2840 } |
2843 #endif | 2841 #endif |
2844 | 2842 |
2845 } // namespace policy | 2843 } // namespace policy |
OLD | NEW |