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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc

Issue 1685003002: Plumb the correct owner document through DocumentInit::m_owner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
index 3281f89fc007dd8bfc1ebcb4f379bd421f720bed..00252604a6a78b066e0abb7cb38c112aaefadbfc 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_unittest.cc
@@ -72,6 +72,7 @@
#include "components/user_manager/fake_user_manager.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/test/test_utils.h"
+#include "content/public/test/web_contents_tester.h"
#include "extensions/browser/app_window/app_window_contents.h"
#include "extensions/browser/app_window/app_window_registry.h"
#include "extensions/browser/app_window/native_app_window.h"
@@ -745,13 +746,21 @@ class V1App : public TestBrowserWindow {
// Upon destruction it will properly close the application.
class V2App {
public:
- V2App(Profile* profile, const extensions::Extension* extension) {
+ V2App(Profile* profile, const extensions::Extension* extension)
+ : creator_web_contents_(
+ content::WebContentsTester::CreateTestWebContents(profile,
+ nullptr)) {
window_ = new extensions::AppWindow(profile, new ChromeAppDelegate(true),
extension);
extensions::AppWindow::CreateParams params =
extensions::AppWindow::CreateParams();
+ // Note: normally, the creator RFH is the background page of the
+ // app/extension
+ // calling chrome.app.window.create. For unit testing purposes, just passing
+ // in a random RenderFrameHost is Good Enoughâ„¢.
window_->Init(GURL(std::string()),
- new extensions::AppWindowContentsImpl(window_), params);
+ new extensions::AppWindowContentsImpl(window_),
+ creator_web_contents_->GetMainFrame(), params);
}
virtual ~V2App() {
@@ -763,6 +772,8 @@ class V2App {
extensions::AppWindow* window() { return window_; }
private:
+ scoped_ptr<content::WebContents> creator_web_contents_;
+
// The app window which represents the application. Note that the window
// deletes itself asynchronously after window_->GetBaseWindow()->Close() gets
// called.

Powered by Google App Engine
This is Rietveld 408576698