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 "chrome/browser/extensions/extension_apitest.h" | 5 #include "chrome/browser/extensions/extension_apitest.h" |
6 #include "net/base/mock_host_resolver.h" | 6 #include "net/dns/mock_host_resolver.h" |
7 | 7 |
8 class ExecuteScriptApiTest : public ExtensionApiTest { | 8 class ExecuteScriptApiTest : public ExtensionApiTest { |
9 protected: | 9 protected: |
10 void SetupDelayedHostResolver() { | 10 void SetupDelayedHostResolver() { |
11 // We need a.com to be a little bit slow to trigger a race condition. | 11 // We need a.com to be a little bit slow to trigger a race condition. |
12 host_resolver()->AddRuleWithLatency("a.com", "127.0.0.1", 500); | 12 host_resolver()->AddRuleWithLatency("a.com", "127.0.0.1", 500); |
13 host_resolver()->AddRule("b.com", "127.0.0.1"); | 13 host_resolver()->AddRule("b.com", "127.0.0.1"); |
14 host_resolver()->AddRule("c.com", "127.0.0.1"); | 14 host_resolver()->AddRule("c.com", "127.0.0.1"); |
15 } | 15 } |
16 }; | 16 }; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 SetupDelayedHostResolver(); | 84 SetupDelayedHostResolver(); |
85 ASSERT_TRUE(StartTestServer()); | 85 ASSERT_TRUE(StartTestServer()); |
86 ASSERT_TRUE(RunExtensionTest("executescript/run_at")) << message_; | 86 ASSERT_TRUE(RunExtensionTest("executescript/run_at")) << message_; |
87 } | 87 } |
88 | 88 |
89 IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptCallback) { | 89 IN_PROC_BROWSER_TEST_F(ExecuteScriptApiTest, ExecuteScriptCallback) { |
90 SetupDelayedHostResolver(); | 90 SetupDelayedHostResolver(); |
91 ASSERT_TRUE(StartTestServer()); | 91 ASSERT_TRUE(StartTestServer()); |
92 ASSERT_TRUE(RunExtensionTest("executescript/callback")) << message_; | 92 ASSERT_TRUE(RunExtensionTest("executescript/callback")) << message_; |
93 } | 93 } |
OLD | NEW |