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

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

Issue 1201063002: Set up the infrastructure for Extension event metrics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaaaaase Created 5 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/extensions/extension_apitest.h" 9 #include "chrome/browser/extensions/extension_apitest.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 } 148 }
149 149
150 // Tests chrome.runtime.onMessage, which exercises WebUI registering and 150 // Tests chrome.runtime.onMessage, which exercises WebUI registering and
151 // receiving an event. 151 // receiving an event.
152 IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, OnMessage) { 152 IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, OnMessage) {
153 ASSERT_TRUE(RunTestOnExtensionsFrame("on_message.js")); 153 ASSERT_TRUE(RunTestOnExtensionsFrame("on_message.js"));
154 154
155 OnMessage::Info info; 155 OnMessage::Info info;
156 info.data = "hi"; 156 info.data = "hi";
157 info.last_message = true; 157 info.last_message = true;
158 EventRouter::Get(profile())->BroadcastEvent(make_scoped_ptr( 158 EventRouter::Get(profile())->BroadcastEvent(make_scoped_ptr(new Event(
159 new Event(OnMessage::kEventName, OnMessage::Create(info)))); 159 events::UNKNOWN, OnMessage::kEventName, OnMessage::Create(info))));
160 160
161 scoped_ptr<ExtensionTestMessageListener> listener( 161 scoped_ptr<ExtensionTestMessageListener> listener(
162 new ExtensionTestMessageListener(false)); 162 new ExtensionTestMessageListener(false));
163 ASSERT_TRUE(listener->WaitUntilSatisfied()); 163 ASSERT_TRUE(listener->WaitUntilSatisfied());
164 EXPECT_EQ("true", listener->message()); 164 EXPECT_EQ("true", listener->message());
165 } 165 }
166 166
167 // Tests chrome.runtime.lastError, which exercises WebUI accessing a property 167 // Tests chrome.runtime.lastError, which exercises WebUI accessing a property
168 // on an API which it doesn't actually have access to. A bindings test really. 168 // on an API which it doesn't actually have access to. A bindings test really.
169 IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, RuntimeLastError) { 169 IN_PROC_BROWSER_TEST_F(ExtensionWebUITest, RuntimeLastError) {
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 237
238 ASSERT_TRUE(listener->WaitUntilSatisfied()); 238 ASSERT_TRUE(listener->WaitUntilSatisfied());
239 listener->Reply(extension_id); 239 listener->Reply(extension_id);
240 listener.reset(new ExtensionTestMessageListener("createfailed", false)); 240 listener.reset(new ExtensionTestMessageListener("createfailed", false));
241 ASSERT_TRUE(listener->WaitUntilSatisfied()); 241 ASSERT_TRUE(listener->WaitUntilSatisfied());
242 } 242 }
243 243
244 } // namespace 244 } // namespace
245 245
246 } // namespace extensions 246 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_messages_apitest.cc ('k') | chrome/browser/extensions/menu_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698