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

Side by Side Diff: chrome/browser/extensions/extension_apitest.h

Issue 3210007: Add support for a "split" incognito behavior for extensions. (Closed)
Patch Set: latest Created 10 years, 3 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 (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <string> 10 #include <string>
(...skipping 21 matching lines...) Expand all
32 // received. 32 // received.
33 class ResultCatcher : public NotificationObserver { 33 class ResultCatcher : public NotificationObserver {
34 public: 34 public:
35 ResultCatcher(); 35 ResultCatcher();
36 ~ResultCatcher(); 36 ~ResultCatcher();
37 37
38 // Pumps the UI loop until a notification is received that an API test 38 // Pumps the UI loop until a notification is received that an API test
39 // succeeded or failed. Returns true if the test succeeded, false otherwise. 39 // succeeded or failed. Returns true if the test succeeded, false otherwise.
40 bool GetNextResult(); 40 bool GetNextResult();
41 41
42 void RestrictToProfile(Profile* profile) { profile_restriction_ = profile; }
43
42 const std::string& message() { return message_; } 44 const std::string& message() { return message_; }
43 45
44 private: 46 private:
45 virtual void Observe(NotificationType type, 47 virtual void Observe(NotificationType type,
46 const NotificationSource& source, 48 const NotificationSource& source,
47 const NotificationDetails& details); 49 const NotificationDetails& details);
48 50
49 NotificationRegistrar registrar_; 51 NotificationRegistrar registrar_;
50 52
51 // A sequential list of pass/fail notifications from the test extension(s). 53 // A sequential list of pass/fail notifications from the test extension(s).
52 std::deque<bool> results_; 54 std::deque<bool> results_;
53 55
54 // If it failed, what was the error message? 56 // If it failed, what was the error message?
55 std::deque<std::string> messages_; 57 std::deque<std::string> messages_;
56 std::string message_; 58 std::string message_;
59
60 // If non-NULL, we will listen to events from this profile only.
61 Profile* profile_restriction_;
57 }; 62 };
58 63
59 // Load |extension_name| and wait for pass / fail notification. 64 // Load |extension_name| and wait for pass / fail notification.
60 // |extension_name| is a directory in "test/data/extensions/api_test". 65 // |extension_name| is a directory in "test/data/extensions/api_test".
61 bool RunExtensionTest(const char* extension_name); 66 bool RunExtensionTest(const char* extension_name);
62 67
63 // Load |extension_name|, load page at path |subtest_page| under the 68 // Load |extension_name|, load page at path |subtest_page| under the
64 // extension, and wait for pass / fail notification. |extension_name| 69 // extension, and wait for pass / fail notification. |extension_name|
65 // is a directory in "test/data/extensions/api_test". 70 // is a directory in "test/data/extensions/api_test".
66 bool RunExtensionSubtest(const char* extension_name, 71 bool RunExtensionSubtest(const char* extension_name,
67 const std::string& subtest_page); 72 const std::string& subtest_page);
68 73
69 // Test that exactly one extension loaded. If so, return a pointer to 74 // Test that exactly one extension loaded. If so, return a pointer to
70 // the extension. If not, return NULL and set message_. 75 // the extension. If not, return NULL and set message_.
71 Extension* GetSingleLoadedExtension(); 76 Extension* GetSingleLoadedExtension();
72 77
73 // All extensions tested by ExtensionApiTest are in the "api_test" dir. 78 // All extensions tested by ExtensionApiTest are in the "api_test" dir.
74 virtual void SetUpCommandLine(CommandLine* command_line); 79 virtual void SetUpCommandLine(CommandLine* command_line);
75 80
76 // If it failed, what was the error message? 81 // If it failed, what was the error message?
77 std::string message_; 82 std::string message_;
78 83
79 private: 84 private:
80 bool RunExtensionTestImpl(const char* extension_name, 85 bool RunExtensionTestImpl(const char* extension_name,
81 const std::string& test_page); 86 const std::string& test_page);
82 }; 87 };
83 88
84 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_ 89 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_APITEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_accessibility_api.cc ('k') | chrome/browser/extensions/extension_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698