Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: chrome/browser/extensions/active_script_controller_browsertest.cc

Issue 496863003: Consolidate ExtensionAction execution code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « chrome/browser/extensions/active_script_controller.cc ('k') | chrome/browser/extensions/active_tab_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698