summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/test_extension_loader.h
blob: e0ef19374c12e4aae05f295e751867f55024ea78 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_LOADER_H_
#define CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_LOADER_H_

#include "chrome/common/extensions/extension.h"
#include "chrome/common/notification_observer.h"
#include "chrome/common/notification_registrar.h"

class Extension;
class FilePath;
class Profile;

class TestExtensionLoader : public NotificationObserver {
 public:
  explicit TestExtensionLoader(Profile* profile);

  // Tells the extension service to load the extension at the given path.  It
  // waits for the extension with the expected ID to load, then returns a
  // handle to it.
  Extension* Load(const char* extension_id, const FilePath& path);

  // Same as above, but installs from a CRX first.
  Extension* Install(const char* extension_id, const FilePath& path);

  virtual void Observe(NotificationType type,
                       const NotificationSource& source,
                       const NotificationDetails& details);

 private:
  Profile* profile_;
  Extension* extension_;
  NotificationRegistrar registrar_;
  std::string loading_extension_id_;

  DISALLOW_COPY_AND_ASSIGN(TestExtensionLoader);
};

#endif  // CHROME_BROWSER_EXTENSIONS_TEST_EXTENSION_LOADER_H_