blob: 4f23236a05cdc92b71a1451d1fea5626b0c09bd8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "chrome/browser/browser.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/pref_names.h"
// Tests setting a single proxy to cover all schemes.
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ProxySingle) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
ASSERT_TRUE(RunExtensionTest("proxy/single")) << message_;
Extension* extension = GetSingleLoadedExtension();
ASSERT_TRUE(extension);
PrefService* pref_service = browser()->profile()->GetPrefs();
// There should be no values superseding the extension-set proxy in this test.
std::string proxy_server = pref_service->GetString(prefs::kProxyServer);
ASSERT_EQ("http=http://127.0.0.1:100;"
"https=http://127.0.0.1:100;"
"ftp=http://127.0.0.1:100;"
"socks=http://9.9.9.9", proxy_server);
}
// Tests setting separate proxies for each scheme.
IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ProxyIndividual) {
CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kEnableExperimentalExtensionApis);
ASSERT_TRUE(RunExtensionTest("proxy/individual")) << message_;
Extension* extension = GetSingleLoadedExtension();
ASSERT_TRUE(extension);
PrefService* pref_service = browser()->profile()->GetPrefs();
// There should be no values superseding the extension-set proxy in this test.
std::string proxy_server = pref_service->GetString(prefs::kProxyServer);
ASSERT_EQ("http=http://1.1.1.1;"
"https=socks://2.2.2.2;"
"ftp=http://3.3.3.3:9000;"
"socks=socks4://4.4.4.4:9090", proxy_server);
}
|