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

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

Issue 2524553002: [Extensions] Create ChromeTestExtensionLoader (Closed)
Patch Set: compile Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/chrome_extension_test_notification_observer. h> 5 #include <chrome/browser/extensions/chrome_extension_test_notification_observer. h>
6 #include "base/scoped_observer.h" 6 #include "base/scoped_observer.h"
7 #include "chrome/browser/extensions/extension_action_test_util.h" 7 #include "chrome/browser/extensions/extension_action_test_util.h"
8 #include "chrome/browser/extensions/extension_util.h" 8 #include "chrome/browser/extensions/extension_util.h"
9 #include "chrome/browser/profiles/profile_manager.h" 9 #include "chrome/browser/profiles/profile_manager.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 45
46 //////////////////////////////////////////////////////////////////////////////// 46 ////////////////////////////////////////////////////////////////////////////////
47 // ExtensionTestNotificationObserver 47 // ExtensionTestNotificationObserver
48 48
49 ChromeExtensionTestNotificationObserver:: 49 ChromeExtensionTestNotificationObserver::
50 ChromeExtensionTestNotificationObserver(Browser* browser) 50 ChromeExtensionTestNotificationObserver(Browser* browser)
51 : ExtensionTestNotificationObserver(browser ? browser->profile() : nullptr), 51 : ExtensionTestNotificationObserver(browser ? browser->profile() : nullptr),
52 browser_(browser) {} 52 browser_(browser) {}
53 53
54 ChromeExtensionTestNotificationObserver:: 54 ChromeExtensionTestNotificationObserver::
55 ChromeExtensionTestNotificationObserver(content::BrowserContext* context)
56 : ExtensionTestNotificationObserver(context), browser_(nullptr) {}
57
58 ChromeExtensionTestNotificationObserver::
55 ~ChromeExtensionTestNotificationObserver() {} 59 ~ChromeExtensionTestNotificationObserver() {}
56 60
57 content::BrowserContext* 61 content::BrowserContext*
58 ChromeExtensionTestNotificationObserver::GetBrowserContext() { 62 ChromeExtensionTestNotificationObserver::GetBrowserContext() {
59 if (!context_) { 63 if (!context_) {
60 if (browser_) 64 if (browser_)
61 context_ = browser_->profile(); 65 context_ = browser_->profile();
62 else 66 else
63 context_ = ProfileManager::GetActiveUserProfile(); 67 context_ = ProfileManager::GetActiveUserProfile();
64 } 68 }
65 return context_; 69 return context_;
66 } 70 }
67 71
68 bool ChromeExtensionTestNotificationObserver:: 72 bool ChromeExtensionTestNotificationObserver::
69 WaitForPageActionVisibilityChangeTo(int count) { 73 WaitForPageActionVisibilityChangeTo(int count) {
74 DCHECK(browser_);
70 ScopedObserver<extensions::ExtensionActionAPI, 75 ScopedObserver<extensions::ExtensionActionAPI,
71 extensions::ExtensionActionAPI::Observer> 76 extensions::ExtensionActionAPI::Observer>
72 observer(this); 77 observer(this);
73 observer.Add(extensions::ExtensionActionAPI::Get(GetBrowserContext())); 78 observer.Add(extensions::ExtensionActionAPI::Get(GetBrowserContext()));
74 WaitForCondition( 79 WaitForCondition(
75 base::Bind(&HasPageActionVisibilityReachedTarget, browser_, count), NULL); 80 base::Bind(&HasPageActionVisibilityReachedTarget, browser_, count), NULL);
76 return true; 81 return true;
77 } 82 }
78 83
79 bool ChromeExtensionTestNotificationObserver::WaitForExtensionViewsToLoad() { 84 bool ChromeExtensionTestNotificationObserver::WaitForExtensionViewsToLoad() {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 121
117 void ChromeExtensionTestNotificationObserver::WaitForExtensionAndViewLoad() { 122 void ChromeExtensionTestNotificationObserver::WaitForExtensionAndViewLoad() {
118 WaitForExtensionLoad(); 123 WaitForExtensionLoad();
119 WaitForExtensionViewsToLoad(); 124 WaitForExtensionViewsToLoad();
120 } 125 }
121 126
122 void ChromeExtensionTestNotificationObserver::OnPageActionsUpdated( 127 void ChromeExtensionTestNotificationObserver::OnPageActionsUpdated(
123 content::WebContents* web_contents) { 128 content::WebContents* web_contents) {
124 MaybeQuit(); 129 MaybeQuit();
125 } 130 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698