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

Side by Side Diff: chrome/browser/extensions/api/extension_action/browser_action_apitest.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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
OLDNEW
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 // current tab's setting should have changed, but the default setting 465 // current tab's setting should have changed, but the default setting
466 // should not have changed. 466 // should not have changed.
467 ASSERT_TRUE(browser_action->HasPopup(tab_id)) 467 ASSERT_TRUE(browser_action->HasPopup(tab_id))
468 << "Clicking on the browser action should have caused a popup to " 468 << "Clicking on the browser action should have caused a popup to "
469 << "be added."; 469 << "be added.";
470 ASSERT_FALSE(browser_action->HasPopup(ExtensionAction::kDefaultTabId)) 470 ASSERT_FALSE(browser_action->HasPopup(ExtensionAction::kDefaultTabId))
471 << "Clicking on the browser action should not have set a default " 471 << "Clicking on the browser action should not have set a default "
472 << "popup."; 472 << "popup.";
473 473
474 ASSERT_STREQ("/a_popup.html", 474 ASSERT_STREQ("/a_popup.html",
475 browser_action->GetPopupUrl(tab_id).path().c_str()); 475 browser_action->GetPopupUrl(tab_id).path().as_string().c_str());
476 476
477 // Now change the popup from a_popup.html to another_popup.html by loading 477 // Now change the popup from a_popup.html to another_popup.html by loading
478 // a page which removes the popup using chrome.browserAction.setPopup(). 478 // a page which removes the popup using chrome.browserAction.setPopup().
479 { 479 {
480 ResultCatcher catcher; 480 ResultCatcher catcher;
481 ui_test_utils::NavigateToURL( 481 ui_test_utils::NavigateToURL(
482 browser(), 482 browser(),
483 GURL(extension->GetResourceURL("change_popup.html"))); 483 GURL(extension->GetResourceURL("change_popup.html")));
484 ASSERT_TRUE(catcher.GetNextResult()); 484 ASSERT_TRUE(catcher.GetNextResult());
485 } 485 }
486 486
487 // The call to setPopup in change_popup.html did not use a tab id, 487 // The call to setPopup in change_popup.html did not use a tab id,
488 // so the default setting should have changed as well as the current tab. 488 // so the default setting should have changed as well as the current tab.
489 ASSERT_TRUE(browser_action->HasPopup(tab_id)); 489 ASSERT_TRUE(browser_action->HasPopup(tab_id));
490 ASSERT_TRUE(browser_action->HasPopup(ExtensionAction::kDefaultTabId)); 490 ASSERT_TRUE(browser_action->HasPopup(ExtensionAction::kDefaultTabId));
491 ASSERT_STREQ("/another_popup.html", 491 ASSERT_STREQ("/another_popup.html",
492 browser_action->GetPopupUrl(tab_id).path().c_str()); 492 browser_action->GetPopupUrl(tab_id).path().as_string().c_str());
493 } 493 }
494 494
495 // Test that calling chrome.browserAction.setPopup() can remove a popup. 495 // Test that calling chrome.browserAction.setPopup() can remove a popup.
496 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionRemovePopup) { 496 IN_PROC_BROWSER_TEST_F(BrowserActionApiTest, BrowserActionRemovePopup) {
497 // Load the extension, which has a browser action with a default popup. 497 // Load the extension, which has a browser action with a default popup.
498 ASSERT_TRUE(RunExtensionTest("browser_action/remove_popup")) << message_; 498 ASSERT_TRUE(RunExtensionTest("browser_action/remove_popup")) << message_;
499 const Extension* extension = GetSingleLoadedExtension(); 499 const Extension* extension = GetSingleLoadedExtension();
500 ASSERT_TRUE(extension) << message_; 500 ASSERT_TRUE(extension) << message_;
501 501
502 int tab_id = ExtensionTabUtil::GetTabId( 502 int tab_id = ExtensionTabUtil::GetTabId(
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 // The test verification below is applicable only to scenarios where the 1040 // The test verification below is applicable only to scenarios where the
1041 // download shelf is supported - on ChromeOS, instead of the download shelf, 1041 // download shelf is supported - on ChromeOS, instead of the download shelf,
1042 // there is a download notification in the right-bottom corner of the screen. 1042 // there is a download notification in the right-bottom corner of the screen.
1043 #if !defined(OS_CHROMEOS) 1043 #if !defined(OS_CHROMEOS)
1044 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible()); 1044 EXPECT_TRUE(browser()->window()->IsDownloadShelfVisible());
1045 #endif 1045 #endif
1046 } 1046 }
1047 1047
1048 } // namespace 1048 } // namespace
1049 } // namespace extensions 1049 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698