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

Side by Side Diff: chrome/test/base/extension_load_waiter.h

Issue 320753002: Support javascript gtests in an extension background page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixup comment Created 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_TEST_BASE_EXTENSION_LOAD_WAITER_H_
6 #define CHROME_TEST_BASE_EXTENSION_LOAD_WAITER_H_
7
8 #include "content/public/browser/notification_observer.h"
9 #include "content/public/browser/notification_registrar.h"
10 #include "content/public/test/test_utils.h"
11
12 namespace content {
13 class BrowserContext;
14 } // namespace content
15
16 // A class used to load and wait for the ChromeVox component extension.
dmazzoni 2014/06/10 16:06:16 Update this comment, this waits for any extension
Peter Lundblad 2014/06/11 16:45:06 Remove chromevox here.
Peter Lundblad 2014/06/11 16:45:06 Remove chromevox here.
Peter Lundblad 2014/06/11 16:45:07 Remove chromevox here.
David Tseng 2014/06/11 17:52:55 Already done.
17 class ExtensionLoadWaiter : public content::NotificationObserver {
18 public:
19 ExtensionLoadWaiter();
20 virtual ~ExtensionLoadWaiter();
21
22 // Waits for extension with |extension_id| to load.
Peter Lundblad 2014/06/11 16:45:06 ^ nit: Do you need a particle here?
Peter Lundblad 2014/06/11 16:45:07 ^ nit: Do you need a particle here?
Peter Lundblad 2014/06/11 16:45:07 ^ nit: Do you need a particle here?
David Tseng 2014/06/11 17:52:55 Particle? Don't follow....it looks fine I think.
23 void WaitFor(const char* extension_id);
Peter Lundblad 2014/06/11 16:45:06 Note in the docs that the extension id should be a
Peter Lundblad 2014/06/11 16:45:06 Note in the docs that the extension id should be a
Peter Lundblad 2014/06/11 16:45:06 Note in the docs that the extension id should be a
David Tseng 2014/06/11 17:52:54 You mean a pointer to a static char array? Ok sure
24
25 // content::NotificationObserver overrides.
26 virtual void Observe(int type,
27 const content::NotificationSource& source,
28 const content::NotificationDetails& details) OVERRIDE;
29
30 // Get the browser context associated with the loaded extension.
Peter Lundblad 2014/06/11 16:45:06 Note that this can only be called after waiting fo
Peter Lundblad 2014/06/11 16:45:06 Note that this can only be called after waiting fo
Peter Lundblad 2014/06/11 16:45:07 Note that this can only be called after waiting fo
David Tseng 2014/06/11 17:52:54 You actually can call it; it will just be NULL. Cl
31 content::BrowserContext* browser_context() { return browser_context_; }
32
33 // Get the id of the loaded extension.
Peter Lundblad 2014/06/11 16:45:06 Either make this class a one-shot only or change d
Peter Lundblad 2014/06/11 16:45:06 Either make this class a one-shot only or change d
Peter Lundblad 2014/06/11 16:45:07 Either make this class a one-shot only or change d
David Tseng 2014/06/11 17:52:54 Made one shot.
34 const char* extension_id() { return extension_id_; }
35
36 private:
37 void Reset();
38
39 content::NotificationRegistrar registrar_;
40 scoped_refptr<content::MessageLoopRunner> load_looper_;
41 const char* extension_id_;
42 content::BrowserContext* browser_context_;
43
44 DISALLOW_COPY_AND_ASSIGN(ExtensionLoadWaiter);
45 };
46
47 #endif // CHROME_TEST_BASE_EXTENSION_LOAD_WAITER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698