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

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

Issue 475813004: Clean up NOTIFICATION_EXTENSION_PAGE_ACTION_[ COUNT | VISIBILITY ]_CHANGED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master for CQ 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
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 "base/strings/utf_string_conversions.h" 5 #include "base/strings/utf_string_conversions.h"
6 #include "chrome/browser/extensions/extension_action.h" 6 #include "chrome/browser/extensions/extension_action.h"
7 #include "chrome/browser/extensions/extension_action_manager.h" 7 #include "chrome/browser/extensions/extension_action_manager.h"
8 #include "chrome/browser/extensions/extension_browsertest.h" 8 #include "chrome/browser/extensions/extension_browsertest.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_tab_util.h" 10 #include "chrome/browser/extensions/extension_tab_util.h"
11 #include "chrome/browser/ui/browser.h" 11 #include "chrome/browser/ui/browser.h"
12 #include "chrome/browser/ui/browser_window.h"
13 #include "chrome/browser/ui/location_bar/location_bar.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
13 #include "chrome/test/base/ui_test_utils.h" 15 #include "chrome/test/base/ui_test_utils.h"
14 #include "extensions/browser/extension_system.h" 16 #include "extensions/browser/extension_system.h"
15 #include "extensions/common/extension.h" 17 #include "extensions/common/extension.h"
16 #include "extensions/common/switches.h" 18 #include "extensions/common/switches.h"
17 19
18 namespace extensions { 20 namespace extensions {
19 namespace { 21 namespace {
20 22
21 const std::string kFeedPage = "files/feeds/feed.html"; 23 const std::string kFeedPage = "files/feeds/feed.html";
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, UnloadPageAction) { 101 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, UnloadPageAction) {
100 ASSERT_TRUE(test_server()->Start()); 102 ASSERT_TRUE(test_server()->Start());
101 103
102 base::FilePath extension_path( 104 base::FilePath extension_path(
103 test_data_dir_.AppendASCII("subscribe_page_action")); 105 test_data_dir_.AppendASCII("subscribe_page_action"));
104 ASSERT_TRUE(LoadExtension(extension_path)); 106 ASSERT_TRUE(LoadExtension(extension_path));
105 107
106 // Navigation prompts the location bar to load page actions. 108 // Navigation prompts the location bar to load page actions.
107 GURL feed_url = test_server()->GetURL(kFeedPage); 109 GURL feed_url = test_server()->GetURL(kFeedPage);
108 ui_test_utils::NavigateToURL(browser(), feed_url); 110 ui_test_utils::NavigateToURL(browser(), feed_url);
109 ASSERT_TRUE(WaitForPageActionCountChangeTo(1)); 111 LocationBarTesting* location_bar =
112 browser()->window()->GetLocationBar()->GetLocationBarForTesting();
113 EXPECT_EQ(1, location_bar->PageActionCount());
110 114
111 UnloadExtension(last_loaded_extension_id()); 115 UnloadExtension(last_loaded_extension_id());
112 116
113 // Make sure the page action goes away when it's unloaded. 117 // Make sure the page action goes away when it's unloaded.
114 ASSERT_TRUE(WaitForPageActionCountChangeTo(0)); 118 EXPECT_EQ(0, location_bar->PageActionCount());
115 } 119 }
116 120
117 // Tests that we can load page actions in the Omnibox. 121 // Tests that we can load page actions in the Omnibox.
118 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionRefreshCrash) { 122 IN_PROC_BROWSER_TEST_F(ExtensionBrowserTest, PageActionRefreshCrash) {
119 base::TimeTicks start_time = base::TimeTicks::Now(); 123 base::TimeTicks start_time = base::TimeTicks::Now();
120 124
121 ExtensionService* service = extensions::ExtensionSystem::Get( 125 ExtensionService* service = extensions::ExtensionSystem::Get(
122 browser()->profile())->extension_service(); 126 browser()->profile())->extension_service();
123 127
124 size_t size_before = service->extensions()->size(); 128 size_t size_before = service->extensions()->size();
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 int tab_id = ExtensionTabUtil::GetTabId( 201 int tab_id = ExtensionTabUtil::GetTabId(
198 browser()->tab_strip_model()->GetActiveWebContents()); 202 browser()->tab_strip_model()->GetActiveWebContents());
199 EXPECT_STREQ(base::WideToUTF8(L"Hreggvi\u00F0ur").c_str(), 203 EXPECT_STREQ(base::WideToUTF8(L"Hreggvi\u00F0ur").c_str(),
200 ExtensionActionManager::Get(browser()->profile())-> 204 ExtensionActionManager::Get(browser()->profile())->
201 GetPageAction(*extension)-> 205 GetPageAction(*extension)->
202 GetTitle(tab_id).c_str()); 206 GetTitle(tab_id).c_str());
203 } 207 }
204 208
205 } // namespace 209 } // namespace
206 } // namespace extensions 210 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/location_bar_controller.cc ('k') | chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698