blob: 0015de9a4ccf73ef9146a5837f087563fde56218 (
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
|
// 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/extensions/extension_apitest.h"
#include "net/base/mock_host_resolver.h"
class ExecuteScriptApiTest : public ExtensionApiTest {
protected:
void SetupDelayedHostResolver() {
// We need a.com to be a little bit slow to trigger a race condition.
host_resolver()->AddRuleWithLatency("a.com", "127.0.0.1", 500);
host_resolver()->AddRule("b.com", "127.0.0.1");
host_resolver()->AddRule("c.com", "127.0.0.1");
}
};
IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptBasic) {
SetupDelayedHostResolver();
ASSERT_TRUE(StartTestServer());
ASSERT_TRUE(RunExtensionTest("executescript/basic")) << message_;
}
IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptInFrame) {
SetupDelayedHostResolver();
ASSERT_TRUE(StartTestServer());
ASSERT_TRUE(RunExtensionTest("executescript/in_frame")) << message_;
}
IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptPermissions) {
SetupDelayedHostResolver();
ASSERT_TRUE(StartTestServer());
ASSERT_TRUE(RunExtensionTest("executescript/permissions")) << message_;
}
IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptFileAfterClose) {
host_resolver()->AddRule("b.com", "127.0.0.1");
ASSERT_TRUE(StartTestServer());
ASSERT_TRUE(RunExtensionTest("executescript/file_after_close")) << message_;
}
|