summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui/webui/extensions/extension_settings_browsertest.h
blob: dcbead3d7da11f3ece166c51a97e17785f7c7096 (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
42
43
44
45
46
// Copyright 2013 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_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_
#define CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_

#include "chrome/browser/extensions/extension_test_notification_observer.h"
#include "chrome/test/base/web_ui_browsertest.h"
#include "extensions/common/extension.h"

class Profile;

// C++ test fixture used by extension_settings_browsertest.js.
class ExtensionSettingsUIBrowserTest : public WebUIBrowserTest {
 public:
  ExtensionSettingsUIBrowserTest();
  virtual ~ExtensionSettingsUIBrowserTest();

 protected:
  // Get the profile to use.
  Profile* GetProfile();

  const std::string& last_loaded_extension_id() {
    return observer_->last_loaded_extension_id();
  }

  virtual void SetUpOnMainThread() OVERRIDE;

  void InstallGoodExtension();

 private:
  bool WaitForExtensionViewsToLoad();
  const extensions::Extension* LoadUnpackedExtension(
      const base::FilePath& path);
  const extensions::Extension* InstallExtension(const base::FilePath& path);

  scoped_ptr<ExtensionTestNotificationObserver> observer_;

  // The default profile to be used.
  Profile* profile_;

  DISALLOW_COPY_AND_ASSIGN(ExtensionSettingsUIBrowserTest);
};

#endif  // CHROME_BROWSER_UI_WEBUI_EXTENSIONS_EXTENSION_SETTINGS_BROWSERTEST_H_