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

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

Issue 269079: Implement new page action API. (Closed)
Patch Set: compile fixes Created 11 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_browser_actions_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "chrome/browser/browser.h" 5 #include "chrome/browser/browser.h"
6 #include "chrome/browser/browser_window.h" 6 #include "chrome/browser/browser_window.h"
7 #include "chrome/browser/extensions/extension_apitest.h" 7 #include "chrome/browser/extensions/extension_apitest.h"
8 #include "chrome/browser/extensions/extension_browser_event_router.h" 8 #include "chrome/browser/extensions/extension_browser_event_router.h"
9 #include "chrome/browser/extensions/extension_tabs_module.h" 9 #include "chrome/browser/extensions/extension_tabs_module.h"
10 #include "chrome/browser/extensions/extensions_service.h" 10 #include "chrome/browser/extensions/extensions_service.h"
(...skipping 18 matching lines...) Expand all
29 ResultCatcher catcher; 29 ResultCatcher catcher;
30 ExtensionsService* service = browser()->profile()->GetExtensionsService(); 30 ExtensionsService* service = browser()->profile()->GetExtensionsService();
31 Extension* extension = service->extensions()->at(0); 31 Extension* extension = service->extensions()->at(0);
32 ui_test_utils::NavigateToURL(browser(), 32 ui_test_utils::NavigateToURL(browser(),
33 GURL(extension->GetResourceURL("update.html"))); 33 GURL(extension->GetResourceURL("update.html")));
34 ASSERT_TRUE(catcher.GetNextResult()); 34 ASSERT_TRUE(catcher.GetNextResult());
35 35
36 // Test that we received the changes. 36 // Test that we received the changes.
37 ExtensionActionState* action_state = extension->browser_action_state(); 37 ExtensionActionState* action_state = extension->browser_action_state();
38 ASSERT_EQ("Modified", action_state->title()); 38 ASSERT_EQ("Modified", action_state->title());
39 ASSERT_EQ(1, action_state->icon_index());
40 ASSERT_EQ("badge", action_state->badge_text()); 39 ASSERT_EQ("badge", action_state->badge_text());
41 ASSERT_EQ(SkColorSetARGB(255, 255, 255, 255), 40 ASSERT_EQ(SkColorSetARGB(255, 255, 255, 255),
42 action_state->badge_background_color()); 41 action_state->badge_background_color());
43 42
44 // Simulate the browser action being clicked. 43 // Simulate the browser action being clicked.
45 ui_test_utils::NavigateToURL(browser(), 44 ui_test_utils::NavigateToURL(browser(),
46 GURL("http://localhost:1337/files/extensions/test_file.txt")); 45 GURL("http://localhost:1337/files/extensions/test_file.txt"));
47 46
48 ExtensionAction* browser_action = service->GetBrowserActions(false)[0]; 47 ExtensionAction* browser_action = service->GetBrowserActions(false)[0];
49 int window_id = ExtensionTabUtil::GetWindowId(browser()); 48 int window_id = ExtensionTabUtil::GetWindowId(browser());
(...skipping 27 matching lines...) Expand all
77 ExtensionsService* service = browser()->profile()->GetExtensionsService(); 76 ExtensionsService* service = browser()->profile()->GetExtensionsService();
78 Extension* extension = service->extensions()->at(0); 77 Extension* extension = service->extensions()->at(0);
79 ui_test_utils::NavigateToURL(browser(), 78 ui_test_utils::NavigateToURL(browser(),
80 GURL(extension->GetResourceURL("update.html"))); 79 GURL(extension->GetResourceURL("update.html")));
81 ASSERT_TRUE(catcher.GetNextResult()); 80 ASSERT_TRUE(catcher.GetNextResult());
82 81
83 // Test that we received the changes. 82 // Test that we received the changes.
84 ExtensionActionState* action_state = extension->browser_action_state(); 83 ExtensionActionState* action_state = extension->browser_action_state();
85 ASSERT_TRUE(action_state->icon()); 84 ASSERT_TRUE(action_state->icon());
86 } 85 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extension_browser_actions_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698