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

Side by Side Diff: chrome/browser/extensions/activity_log/fullstream_ui_policy_unittest.cc

Issue 17948002: Update Linux 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, 5 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/synchronization/waitable_event.h" 8 #include "base/synchronization/waitable_event.h"
9 #include "chrome/browser/extensions/activity_log/activity_log.h" 9 #include "chrome/browser/extensions/activity_log/activity_log.h"
10 #include "chrome/browser/extensions/activity_log/fullstream_ui_policy.h" 10 #include "chrome/browser/extensions/activity_log/fullstream_ui_policy.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 TEST_F(FullStreamUIPolicyTest, Construct) { 91 TEST_F(FullStreamUIPolicyTest, Construct) {
92 scoped_ptr<ActivityLogPolicy> policy(new FullStreamUIPolicy(profile_.get())); 92 scoped_ptr<ActivityLogPolicy> policy(new FullStreamUIPolicy(profile_.get()));
93 scoped_refptr<const Extension> extension = 93 scoped_refptr<const Extension> extension =
94 ExtensionBuilder() 94 ExtensionBuilder()
95 .SetManifest(DictionaryBuilder() 95 .SetManifest(DictionaryBuilder()
96 .Set("name", "Test extension") 96 .Set("name", "Test extension")
97 .Set("version", "1.0.0") 97 .Set("version", "1.0.0")
98 .Set("manifest_version", 2)) 98 .Set("manifest_version", 2))
99 .Build(); 99 .Build();
100 extension_service_->AddExtension(extension); 100 extension_service_->AddExtension(extension.get());
101 scoped_ptr<base::ListValue> args(new base::ListValue()); 101 scoped_ptr<base::ListValue> args(new base::ListValue());
102 policy->ProcessAction(ActivityLogPolicy::ACTION_API, extension->id(), 102 policy->ProcessAction(ActivityLogPolicy::ACTION_API, extension->id(),
103 std::string("tabs.testMethod"), GURL(), args.get(), NULL); 103 std::string("tabs.testMethod"), GURL(), args.get(), NULL);
104 } 104 }
105 105
106 TEST_F(FullStreamUIPolicyTest, LogAndFetchActions) { 106 TEST_F(FullStreamUIPolicyTest, LogAndFetchActions) {
107 scoped_ptr<ActivityLogPolicy> policy(new FullStreamUIPolicy(profile_.get())); 107 scoped_ptr<ActivityLogPolicy> policy(new FullStreamUIPolicy(profile_.get()));
108 scoped_refptr<const Extension> extension = 108 scoped_refptr<const Extension> extension =
109 ExtensionBuilder() 109 ExtensionBuilder()
110 .SetManifest(DictionaryBuilder() 110 .SetManifest(DictionaryBuilder()
111 .Set("name", "Test extension") 111 .Set("name", "Test extension")
112 .Set("version", "1.0.0") 112 .Set("version", "1.0.0")
113 .Set("manifest_version", 2)) 113 .Set("manifest_version", 2))
114 .Build(); 114 .Build();
115 extension_service_->AddExtension(extension); 115 extension_service_->AddExtension(extension.get());
116 scoped_ptr<base::ListValue> args(new base::ListValue()); 116 scoped_ptr<base::ListValue> args(new base::ListValue());
117 GURL gurl("http://www.google.com"); 117 GURL gurl("http://www.google.com");
118 118
119 // Write some API calls 119 // Write some API calls
120 policy->ProcessAction(ActivityLogPolicy::ACTION_API, extension->id(), 120 policy->ProcessAction(ActivityLogPolicy::ACTION_API, extension->id(),
121 std::string("tabs.testMethod"), GURL(), args.get(), NULL); 121 std::string("tabs.testMethod"), GURL(), args.get(), NULL);
122 policy->ProcessAction(ActivityLogPolicy::ACTION_DOM, 122 policy->ProcessAction(ActivityLogPolicy::ACTION_DOM,
123 extension->id(), std::string("document.write"), 123 extension->id(), std::string("document.write"),
124 gurl, args.get(), NULL); 124 gurl, args.get(), NULL);
125 policy->ReadData(extension->id(), 0, 125 policy->ReadData(extension->id(), 0,
126 base::Bind(FullStreamUIPolicyTest::RetrieveActions_LogAndFetchActions)); 126 base::Bind(FullStreamUIPolicyTest::RetrieveActions_LogAndFetchActions));
127 } 127 }
128 128
129 TEST_F(FullStreamUIPolicyTest, LogWithArguments) { 129 TEST_F(FullStreamUIPolicyTest, LogWithArguments) {
130 scoped_ptr<ActivityLogPolicy> policy(new FullStreamUIPolicy(profile_.get())); 130 scoped_ptr<ActivityLogPolicy> policy(new FullStreamUIPolicy(profile_.get()));
131 scoped_refptr<const Extension> extension = 131 scoped_refptr<const Extension> extension =
132 ExtensionBuilder() 132 ExtensionBuilder()
133 .SetManifest(DictionaryBuilder() 133 .SetManifest(DictionaryBuilder()
134 .Set("name", "Test extension") 134 .Set("name", "Test extension")
135 .Set("version", "1.0.0") 135 .Set("version", "1.0.0")
136 .Set("manifest_version", 2)) 136 .Set("manifest_version", 2))
137 .Build(); 137 .Build();
138 extension_service_->AddExtension(extension); 138 extension_service_->AddExtension(extension.get());
139 scoped_ptr<base::ListValue> args(new base::ListValue()); 139 scoped_ptr<base::ListValue> args(new base::ListValue());
140 args->Set(0, new base::StringValue("hello")); 140 args->Set(0, new base::StringValue("hello"));
141 args->Set(1, new base::StringValue("world")); 141 args->Set(1, new base::StringValue("world"));
142 policy->ProcessAction(ActivityLogPolicy::ACTION_API, extension->id(), 142 policy->ProcessAction(ActivityLogPolicy::ACTION_API, extension->id(),
143 std::string("extension.connect"), GURL(), args.get(), NULL); 143 std::string("extension.connect"), GURL(), args.get(), NULL);
144 policy->ReadData(extension->id(), 0, 144 policy->ReadData(extension->id(), 0,
145 base::Bind(FullStreamUIPolicyTest::Arguments_Present)); 145 base::Bind(FullStreamUIPolicyTest::Arguments_Present));
146 } 146 }
147 147
148 } // namespace extensions 148 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698