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

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

Issue 16295003: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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 (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 <string> 5 #include <string>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "chrome/browser/extensions/extension_action.h" 10 #include "chrome/browser/extensions/extension_action.h"
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 ExtensionBuilder() 75 ExtensionBuilder()
76 .SetManifest(DictionaryBuilder() 76 .SetManifest(DictionaryBuilder()
77 .Set("name", "Extension with page action") 77 .Set("name", "Extension with page action")
78 .Set("version", "1.0.0") 78 .Set("version", "1.0.0")
79 .Set("manifest_version", 2) 79 .Set("manifest_version", 2)
80 .Set("permissions", ListBuilder() 80 .Set("permissions", ListBuilder()
81 .Append("tabs")) 81 .Append("tabs"))
82 .Set("page_action", DictionaryBuilder() 82 .Set("page_action", DictionaryBuilder()
83 .Set("default_title", "Hello"))) 83 .Set("default_title", "Hello")))
84 .Build(); 84 .Build();
85 extension_service_->AddExtension(extension); 85 extension_service_->AddExtension(extension.get());
86 86
87 NavigateAndCommit(GURL("http://www.google.com")); 87 NavigateAndCommit(GURL("http://www.google.com"));
88 88
89 ExtensionAction& page_action = *ExtensionActionManager::Get(profile())-> 89 ExtensionAction& page_action =
90 GetPageAction(*extension); 90 *ExtensionActionManager::Get(profile())->GetPageAction(*extension.get());
91 page_action.SetTitle(tab_id(), "Goodbye"); 91 page_action.SetTitle(tab_id(), "Goodbye");
92 page_action.SetPopupUrl( 92 page_action.SetPopupUrl(
93 tab_id(), extension->GetResourceURL("popup.html")); 93 tab_id(), extension->GetResourceURL("popup.html"));
94 94
95 EXPECT_EQ("Goodbye", page_action.GetTitle(tab_id())); 95 EXPECT_EQ("Goodbye", page_action.GetTitle(tab_id()));
96 EXPECT_EQ(extension->GetResourceURL("popup.html"), 96 EXPECT_EQ(extension->GetResourceURL("popup.html"),
97 page_action.GetPopupUrl(tab_id())); 97 page_action.GetPopupUrl(tab_id()));
98 98
99 // Within-page navigation should keep the settings. 99 // Within-page navigation should keep the settings.
100 NavigateAndCommit(GURL("http://www.google.com/#hash")); 100 NavigateAndCommit(GURL("http://www.google.com/#hash"));
101 101
102 EXPECT_EQ("Goodbye", page_action.GetTitle(tab_id())); 102 EXPECT_EQ("Goodbye", page_action.GetTitle(tab_id()));
103 EXPECT_EQ(extension->GetResourceURL("popup.html"), 103 EXPECT_EQ(extension->GetResourceURL("popup.html"),
104 page_action.GetPopupUrl(tab_id())); 104 page_action.GetPopupUrl(tab_id()));
105 105
106 // Should discard the settings, and go back to the defaults. 106 // Should discard the settings, and go back to the defaults.
107 NavigateAndCommit(GURL("http://www.yahoo.com")); 107 NavigateAndCommit(GURL("http://www.yahoo.com"));
108 108
109 EXPECT_EQ("Hello", page_action.GetTitle(tab_id())); 109 EXPECT_EQ("Hello", page_action.GetTitle(tab_id()));
110 EXPECT_EQ(GURL(), page_action.GetPopupUrl(tab_id())); 110 EXPECT_EQ(GURL(), page_action.GetPopupUrl(tab_id()));
111 }; 111 };
112 112
113 } // namespace 113 } // namespace
114 } // namespace extensions 114 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/menu_manager_unittest.cc ('k') | chrome/browser/extensions/permissions_updater.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698