| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/files/file_path.h" | 5 #include "base/files/file_path.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
| 9 #include "chrome/browser/extensions/test_extension_dir.h" | 9 #include "chrome/browser/extensions/test_extension_dir.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 return testing::AssertionSuccess(); | 190 return testing::AssertionSuccess(); |
| 191 } | 191 } |
| 192 | 192 |
| 193 | 193 |
| 194 // Try different permutations of "match all", "match particular domain (that is | 194 // Try different permutations of "match all", "match particular domain (that is |
| 195 // visited by test)", and "match nonsense domain (not visited by test)" for | 195 // visited by test)", and "match nonsense domain (not visited by test)" for |
| 196 // both manifest permissions and injection matcher conditions. | 196 // both manifest permissions and injection matcher conditions. |
| 197 // http://crbug.com/421118 | 197 // http://crbug.com/421118 |
| 198 IN_PROC_BROWSER_TEST_F(RequestContentScriptAPITest, | 198 IN_PROC_BROWSER_TEST_F(RequestContentScriptAPITest, |
| 199 DISABLED_PermissionMatcherAgreementInjection) { | 199 DISABLED_PermissionMatcherAgreementInjection) { |
| 200 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 200 ASSERT_TRUE(embedded_test_server()->Start()); |
| 201 | 201 |
| 202 // Positive tests: permissions and matcher contain conditions that match URL | 202 // Positive tests: permissions and matcher contain conditions that match URL |
| 203 // visited during test. | 203 // visited during test. |
| 204 EXPECT_TRUE(RunTest(ALL, ALL, true)); | 204 EXPECT_TRUE(RunTest(ALL, ALL, true)); |
| 205 EXPECT_TRUE(RunTest(ALL, PARTICULAR, true)); | 205 EXPECT_TRUE(RunTest(ALL, PARTICULAR, true)); |
| 206 EXPECT_TRUE(RunTest(PARTICULAR, ALL, true)); | 206 EXPECT_TRUE(RunTest(PARTICULAR, ALL, true)); |
| 207 EXPECT_TRUE(RunTest(PARTICULAR, PARTICULAR, true)); | 207 EXPECT_TRUE(RunTest(PARTICULAR, PARTICULAR, true)); |
| 208 | 208 |
| 209 // Negative tests: permissions or matcher (or both) contain conditions that | 209 // Negative tests: permissions or matcher (or both) contain conditions that |
| 210 // do not match URL visited during test. | 210 // do not match URL visited during test. |
| 211 EXPECT_TRUE(RunTest(NOWHERE, ALL, false)); | 211 EXPECT_TRUE(RunTest(NOWHERE, ALL, false)); |
| 212 EXPECT_TRUE(RunTest(NOWHERE, PARTICULAR, false)); | 212 EXPECT_TRUE(RunTest(NOWHERE, PARTICULAR, false)); |
| 213 EXPECT_TRUE(RunTest(NOWHERE, NOWHERE, false)); | 213 EXPECT_TRUE(RunTest(NOWHERE, NOWHERE, false)); |
| 214 EXPECT_TRUE(RunTest(ALL, NOWHERE, false)); | 214 EXPECT_TRUE(RunTest(ALL, NOWHERE, false)); |
| 215 EXPECT_TRUE(RunTest(PARTICULAR, NOWHERE, false)); | 215 EXPECT_TRUE(RunTest(PARTICULAR, NOWHERE, false)); |
| 216 | 216 |
| 217 // TODO(markdittmer): Add more tests: | 217 // TODO(markdittmer): Add more tests: |
| 218 // - Inject script with multiple files | 218 // - Inject script with multiple files |
| 219 // - Inject multiple scripts | 219 // - Inject multiple scripts |
| 220 // - Match on CSS selector conditions | 220 // - Match on CSS selector conditions |
| 221 // - Match all frames in document containing frames | 221 // - Match all frames in document containing frames |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace extensions | 224 } // namespace extensions |
| OLD | NEW |