| 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/active_script_controller.h" | 8 #include "chrome/browser/extensions/active_script_controller.h" |
| 9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
| 10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 // script has *not* already executed. | 270 // script has *not* already executed. |
| 271 if (inject_success_listener_->was_satisfied()) { | 271 if (inject_success_listener_->was_satisfied()) { |
| 272 return testing::AssertionFailure() << | 272 return testing::AssertionFailure() << |
| 273 name_ << "'s script ran without permission."; | 273 name_ << "'s script ran without permission."; |
| 274 } | 274 } |
| 275 | 275 |
| 276 // If we reach this point, we should always have an action. | 276 // If we reach this point, we should always have an action. |
| 277 DCHECK(action); | 277 DCHECK(action); |
| 278 | 278 |
| 279 // Grant permission by clicking on the extension action. | 279 // Grant permission by clicking on the extension action. |
| 280 location_bar_controller->OnClicked(action); | 280 controller->OnClicked(extension_); |
| 281 | 281 |
| 282 // Now, the extension should be able to inject the script. | 282 // Now, the extension should be able to inject the script. |
| 283 inject_success_listener_->WaitUntilSatisfied(); | 283 inject_success_listener_->WaitUntilSatisfied(); |
| 284 | 284 |
| 285 // The Action should have disappeared. | 285 // The Action should have disappeared. |
| 286 has_action = GetAction() != NULL; | 286 has_action = GetAction() != NULL; |
| 287 if (has_action) { | 287 if (has_action) { |
| 288 return testing::AssertionFailure() | 288 return testing::AssertionFailure() |
| 289 << "Extension " << name_ << " has lingering action."; | 289 << "Extension " << name_ << " has lingering action."; |
| 290 } | 290 } |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 | 452 |
| 453 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 453 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 454 ui_test_utils::NavigateToURL( | 454 ui_test_utils::NavigateToURL( |
| 455 browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); | 455 browser(), embedded_test_server()->GetURL("/extensions/test_file.html")); |
| 456 | 456 |
| 457 for (size_t i = 0u; i < arraysize(testers); ++i) | 457 for (size_t i = 0u; i < arraysize(testers); ++i) |
| 458 EXPECT_TRUE(testers[i].Verify()) << kExtensionNames[i]; | 458 EXPECT_TRUE(testers[i].Verify()) << kExtensionNames[i]; |
| 459 } | 459 } |
| 460 | 460 |
| 461 } // namespace extensions | 461 } // namespace extensions |
| OLD | NEW |