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

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

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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "chrome/browser/extensions/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 6
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/browser.h" 8 #include "chrome/browser/browser.h"
9 #include "chrome/browser/extensions/extensions_service.h" 9 #include "chrome/browser/extensions/extensions_service.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
11 #include "chrome/common/notification_registrar.h" 11 #include "chrome/common/notification_registrar.h"
12 #include "chrome/test/ui_test_utils.h" 12 #include "chrome/test/ui_test_utils.h"
13 13
14 ExtensionApiTest::ResultCatcher::ResultCatcher() { 14 ExtensionApiTest::ResultCatcher::ResultCatcher()
15 : profile_restriction_(NULL) {
15 registrar_.Add(this, NotificationType::EXTENSION_TEST_PASSED, 16 registrar_.Add(this, NotificationType::EXTENSION_TEST_PASSED,
16 NotificationService::AllSources()); 17 NotificationService::AllSources());
17 registrar_.Add(this, NotificationType::EXTENSION_TEST_FAILED, 18 registrar_.Add(this, NotificationType::EXTENSION_TEST_FAILED,
18 NotificationService::AllSources()); 19 NotificationService::AllSources());
19 } 20 }
20 21
21 ExtensionApiTest::ResultCatcher::~ResultCatcher() { 22 ExtensionApiTest::ResultCatcher::~ResultCatcher() {
22 } 23 }
23 24
24 bool ExtensionApiTest::ResultCatcher::GetNextResult() { 25 bool ExtensionApiTest::ResultCatcher::GetNextResult() {
(...skipping 12 matching lines...) Expand all
37 return ret; 38 return ret;
38 } 39 }
39 40
40 NOTREACHED(); 41 NOTREACHED();
41 return false; 42 return false;
42 } 43 }
43 44
44 void ExtensionApiTest::ResultCatcher::Observe( 45 void ExtensionApiTest::ResultCatcher::Observe(
45 NotificationType type, const NotificationSource& source, 46 NotificationType type, const NotificationSource& source,
46 const NotificationDetails& details) { 47 const NotificationDetails& details) {
48 if (profile_restriction_ &&
49 Source<Profile>(source).ptr() != profile_restriction_) {
50 return;
51 }
52
47 switch (type.value) { 53 switch (type.value) {
48 case NotificationType::EXTENSION_TEST_PASSED: 54 case NotificationType::EXTENSION_TEST_PASSED:
49 std::cout << "Got EXTENSION_TEST_PASSED notification.\n"; 55 std::cout << "Got EXTENSION_TEST_PASSED notification.\n";
50 results_.push_back(true); 56 results_.push_back(true);
51 messages_.push_back(""); 57 messages_.push_back("");
52 MessageLoopForUI::current()->Quit(); 58 MessageLoopForUI::current()->Quit();
53 break; 59 break;
54 60
55 case NotificationType::EXTENSION_TEST_FAILED: 61 case NotificationType::EXTENSION_TEST_FAILED:
56 std::cout << "Got EXTENSION_TEST_FAILED notification.\n"; 62 std::cout << "Got EXTENSION_TEST_FAILED notification.\n";
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 message_ = "extension pointer is NULL."; 138 message_ = "extension pointer is NULL.";
133 return NULL; 139 return NULL;
134 } 140 }
135 return extension; 141 return extension;
136 } 142 }
137 143
138 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) { 144 void ExtensionApiTest::SetUpCommandLine(CommandLine* command_line) {
139 ExtensionBrowserTest::SetUpCommandLine(command_line); 145 ExtensionBrowserTest::SetUpCommandLine(command_line);
140 test_data_dir_ = test_data_dir_.AppendASCII("api_test"); 146 test_data_dir_ = test_data_dir_.AppendASCII("api_test");
141 } 147 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_apitest.h ('k') | chrome/browser/extensions/extension_bookmark_manager_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698