From f701930f2094bea08a1aa8425c8d704b8f3ef579 Mon Sep 17 00:00:00 2001
From: "mad@chromium.org"
 <mad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 26 Mar 2010 19:58:32 +0000
Subject: [PATCH] Committing for Eric Dingle.

http://codereview.chromium.org/890005

BUG=0
TEST=none


git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42800 0039d316-1c4b-4281-b951-d872f2087c98
---
 .../automation/automation_provider_win.cc     |  2 +-
 chrome/browser/external_tab_container.cc      | 14 +++-
 chrome/browser/external_tab_container.h       |  8 +-
 chrome/browser/tab_contents/tab_contents.cc   | 14 ++++
 .../tab_contents/tab_contents_delegate.h      |  3 +
 chrome/test/automation/automation_messages.h  |  7 +-
 chrome_frame/chrome_active_document.cc        |  3 +-
 chrome_frame/chrome_frame_activex.cc          |  2 +-
 chrome_frame/chrome_frame_automation.cc       | 26 +++---
 chrome_frame/chrome_frame_automation.h        |  9 +-
 chrome_frame/chrome_frame_npapi.cc            |  2 +-
 chrome_frame/chrome_frame_npapi_unittest.cc   | 13 ++-
 chrome_frame/chrome_frame_plugin.h            | 17 +++-
 chrome_frame/delete_chrome_history.cc         |  2 +-
 chrome_frame/test/automation_client_mock.cc   | 84 ++++++++++++++++---
 .../test/chrome_frame_automation_mock.h       | 27 ++++--
 16 files changed, 174 insertions(+), 59 deletions(-)

diff --git a/chrome/browser/automation/automation_provider_win.cc b/chrome/browser/automation/automation_provider_win.cc
index 95394981b00a4..c3520181a4248 100644
--- a/chrome/browser/automation/automation_provider_win.cc
+++ b/chrome/browser/automation/automation_provider_win.cc
@@ -325,7 +325,7 @@ void AutomationProvider::CreateExternalTab(
   external_tab_container->Init(profile, settings.parent, settings.dimensions,
       settings.style, settings.load_requests_via_automation,
       settings.handle_top_level_requests, NULL, settings.initial_url,
-      settings.referrer);
+      settings.referrer, settings.infobars_enabled);
 
   if (AddExternalTab(external_tab_container)) {
     TabContents* tab_contents = external_tab_container->tab_contents();
diff --git a/chrome/browser/external_tab_container.cc b/chrome/browser/external_tab_container.cc
index e6d12113e37dc..4c46493f25cdd 100644
--- a/chrome/browser/external_tab_container.cc
+++ b/chrome/browser/external_tab_container.cc
@@ -54,7 +54,8 @@ ExternalTabContainer::ExternalTabContainer(
       external_method_factory_(this),
       enabled_extension_automation_(false),
       waiting_for_unload_event_(false),
-      pending_(false) {
+      pending_(false),
+      infobars_enabled_(true) {
 }
 
 ExternalTabContainer::~ExternalTabContainer() {
@@ -69,7 +70,8 @@ bool ExternalTabContainer::Init(Profile* profile,
                                 bool handle_top_level_requests,
                                 TabContents* existing_contents,
                                 const GURL& initial_url,
-                                const GURL& referrer) {
+                                const GURL& referrer,
+                                bool infobars_enabled) {
   if (IsWindow()) {
     NOTREACHED();
     return false;
@@ -77,6 +79,7 @@ bool ExternalTabContainer::Init(Profile* profile,
 
   load_requests_via_automation_ = load_requests_via_automation;
   handle_top_level_requests_ = handle_top_level_requests;
+  infobars_enabled_ = infobars_enabled;
 
   set_window_style(WS_POPUP | WS_CLIPCHILDREN);
   views::WidgetWin::Init(NULL, bounds);
@@ -351,7 +354,8 @@ void ExternalTabContainer::AddNewContents(TabContents* source,
       handle_top_level_requests_,
       new_contents,
       GURL(),
-      GURL());
+      GURL(),
+      true);
 
   if (result) {
     uintptr_t cookie = reinterpret_cast<uintptr_t>(new_container.get());
@@ -379,6 +383,10 @@ void ExternalTabContainer::TabContentsCreated(TabContents* new_contents) {
   RegisterRenderViewHostForAutomation(rvh, true);
 }
 
+bool ExternalTabContainer::infobars_enabled() {
+  return infobars_enabled_;
+}
+
 void ExternalTabContainer::ActivateContents(TabContents* contents) {
 }
 
diff --git a/chrome/browser/external_tab_container.h b/chrome/browser/external_tab_container.h
index 123d13c36a951..dcf30ee8f2be8 100644
--- a/chrome/browser/external_tab_container.h
+++ b/chrome/browser/external_tab_container.h
@@ -65,7 +65,8 @@ class ExternalTabContainer : public TabContentsDelegate,
             bool handle_top_level_requests,
             TabContents* existing_tab_contents,
             const GURL& initial_url,
-            const GURL& referrer);
+            const GURL& referrer,
+            bool infobars_enabled);
 
   // Unhook the keystroke listener and notify about the closing TabContents.
   // This function gets called from three places, which is fine.
@@ -202,6 +203,8 @@ class ExternalTabContainer : public TabContentsDelegate,
 
   virtual void TabContentsCreated(TabContents* new_contents);
 
+  virtual bool infobars_enabled();
+
  protected:
   // Overridden from views::WidgetWin:
   virtual LRESULT OnCreate(LPCREATESTRUCT create_struct);
@@ -325,6 +328,9 @@ class ExternalTabContainer : public TabContentsDelegate,
   // from the host.
   bool pending_;
 
+  // Set to true if the ExternalTabContainer if infobars should be enabled.
+  bool infobars_enabled_;
+
   DISALLOW_COPY_AND_ASSIGN(ExternalTabContainer);
 };
 
diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc
index 83b6f55395460..f739a9e701a62 100644
--- a/chrome/browser/tab_contents/tab_contents.cc
+++ b/chrome/browser/tab_contents/tab_contents.cc
@@ -955,6 +955,11 @@ bool TabContents::FocusLocationBarByDefault() {
 }
 
 void TabContents::AddInfoBar(InfoBarDelegate* delegate) {
+  if (delegate_ && !delegate_->infobars_enabled()) {
+    delegate->InfoBarClosed();
+    return;
+  }
+
   // Look through the existing InfoBarDelegates we have for a match. If we've
   // already got one that matches, then we don't add the new one.
   for (int i = 0; i < infobar_delegate_count(); ++i) {
@@ -981,6 +986,10 @@ void TabContents::AddInfoBar(InfoBarDelegate* delegate) {
 }
 
 void TabContents::RemoveInfoBar(InfoBarDelegate* delegate) {
+  if (delegate_ && !delegate_->infobars_enabled()) {
+    return;
+  }
+
   std::vector<InfoBarDelegate*>::iterator it =
       find(infobar_delegates_.begin(), infobar_delegates_.end(), delegate);
   if (it != infobar_delegates_.end()) {
@@ -1001,6 +1010,11 @@ void TabContents::RemoveInfoBar(InfoBarDelegate* delegate) {
 
 void TabContents::ReplaceInfoBar(InfoBarDelegate* old_delegate,
                                  InfoBarDelegate* new_delegate) {
+  if (delegate_ && !delegate_->infobars_enabled()) {
+    new_delegate->InfoBarClosed();
+    return;
+  }
+
   std::vector<InfoBarDelegate*>::iterator it =
       find(infobar_delegates_.begin(), infobar_delegates_.end(), old_delegate);
   DCHECK(it != infobar_delegates_.end());
diff --git a/chrome/browser/tab_contents/tab_contents_delegate.h b/chrome/browser/tab_contents/tab_contents_delegate.h
index 25653f444455e..9a84f83ce79fa 100644
--- a/chrome/browser/tab_contents/tab_contents_delegate.h
+++ b/chrome/browser/tab_contents/tab_contents_delegate.h
@@ -283,6 +283,9 @@ class TabContentsDelegate : public AutomationResourceRoutingDelegate {
   // typically happens when popups are created.
   virtual void TabContentsCreated(TabContents* new_contents) {}
 
+  // Returns whether infobars are enabled. Overrideable by child classes.
+  virtual bool infobars_enabled() { return true; }
+
  protected:
   ~TabContentsDelegate() {}
 };
diff --git a/chrome/test/automation/automation_messages.h b/chrome/test/automation/automation_messages.h
index 42d4731b9db08..22ec4d6a9c36a 100644
--- a/chrome/test/automation/automation_messages.h
+++ b/chrome/test/automation/automation_messages.h
@@ -356,6 +356,7 @@ struct ExternalTabSettings {
   bool handle_top_level_requests;
   GURL initial_url;
   GURL referrer;
+  bool infobars_enabled;
 };
 
 // Traits for ExternalTabSettings structure to pack/unpack.
@@ -371,6 +372,7 @@ struct ParamTraits<ExternalTabSettings> {
     WriteParam(m, p.handle_top_level_requests);
     WriteParam(m, p.initial_url);
     WriteParam(m, p.referrer);
+    WriteParam(m, p.infobars_enabled);
   }
   static bool Read(const Message* m, void** iter, param_type* p) {
     return ReadParam(m, iter, &p->parent) &&
@@ -380,7 +382,8 @@ struct ParamTraits<ExternalTabSettings> {
            ReadParam(m, iter, &p->load_requests_via_automation) &&
            ReadParam(m, iter, &p->handle_top_level_requests) &&
            ReadParam(m, iter, &p->initial_url) &&
-           ReadParam(m, iter, &p->referrer);
+           ReadParam(m, iter, &p->referrer) &&
+           ReadParam(m, iter, &p->infobars_enabled);
   }
   static void Log(const param_type& p, std::wstring* l) {
     l->append(L"(");
@@ -399,6 +402,8 @@ struct ParamTraits<ExternalTabSettings> {
     LogParam(p.initial_url, l);
     l->append(L", ");
     LogParam(p.referrer, l);
+    l->append(L", ");
+    LogParam(p.infobars_enabled, l);
     l->append(L")");
   }
 };
diff --git a/chrome_frame/chrome_active_document.cc b/chrome_frame/chrome_active_document.cc
index ee79e1a9db16f..4f92e702585a1 100644
--- a/chrome_frame/chrome_active_document.cc
+++ b/chrome_frame/chrome_active_document.cc
@@ -1007,7 +1007,8 @@ bool ChromeActiveDocument::LaunchUrl(const std::wstring& url,
 
   automation_client_->SetUrlFetcher(&url_fetcher_);
 
-  if (InitializeAutomation(GetHostProcessName(false), L"", IsIEInPrivate()))
+  if (InitializeAutomation(GetHostProcessName(false), L"", IsIEInPrivate(),
+                           false))
     return true;
 
   return false;
diff --git a/chrome_frame/chrome_frame_activex.cc b/chrome_frame/chrome_frame_activex.cc
index a88c5f14d4f9e..f982072281ccc 100644
--- a/chrome_frame/chrome_frame_activex.cc
+++ b/chrome_frame/chrome_frame_activex.cc
@@ -447,7 +447,7 @@ HRESULT ChromeFrameActivex::IOleObject_SetClientSite(
     url_fetcher_.set_frame_busting(!is_privileged_);
     automation_client_->SetUrlFetcher(&url_fetcher_);
     if (!InitializeAutomation(profile_name, chrome_extra_arguments,
-                              IsIEInPrivate())) {
+                              IsIEInPrivate(), true)) {
       return E_FAIL;
     }
   }
diff --git a/chrome_frame/chrome_frame_automation.cc b/chrome_frame/chrome_frame_automation.cc
index 8c1fb451c0093..3c30d00746c2b 100644
--- a/chrome_frame/chrome_frame_automation.cc
+++ b/chrome_frame/chrome_frame_automation.cc
@@ -440,13 +440,10 @@ ChromeFrameAutomationClient::~ChromeFrameAutomationClient() {
 
 bool ChromeFrameAutomationClient::Initialize(
     ChromeFrameDelegate* chrome_frame_delegate,
-    int automation_server_launch_timeout,
-    bool perform_version_check,
-    const FilePath& profile_path,
-    const std::wstring& extra_chrome_arguments,
-    bool incognito) {
+    const ChromeFrameLaunchParams& chrome_launch_params) {
   DCHECK(!IsWindow());
   chrome_frame_delegate_ = chrome_frame_delegate;
+  chrome_launch_params_ = chrome_launch_params;
   ui_thread_id_ = PlatformThread::CurrentId();
 #ifndef NDEBUG
   // In debug mode give more time to work with a debugger.
@@ -454,10 +451,11 @@ bool ChromeFrameAutomationClient::Initialize(
     // Don't use INFINITE (which is -1) or even MAXINT since we will convert
     // from milliseconds to microseconds when stored in a base::TimeDelta,
     // thus * 1000. An hour should be enough.
-    automation_server_launch_timeout = 60 * 60 * 1000;
+    chrome_launch_params_.automation_server_launch_timeout = 60 * 60 * 1000;
   } else {
-    DCHECK_LT(automation_server_launch_timeout, MAXINT / 2000);
-    automation_server_launch_timeout *= 2;
+    DCHECK_LT(chrome_launch_params_.automation_server_launch_timeout,
+              MAXINT / 2000);
+    chrome_launch_params_.automation_server_launch_timeout *= 2;
   }
 #endif  // NDEBUG
 
@@ -480,14 +478,9 @@ bool ChromeFrameAutomationClient::Initialize(
   // InitializeComplete is called successfully.
   init_state_ = INITIALIZING;
 
-  chrome_launch_params_.automation_server_launch_timeout =
-      automation_server_launch_timeout;
-  chrome_launch_params_.profile_path = profile_path;
-  chrome_launch_params_.profile_name = profile_path.BaseName().value();
-  chrome_launch_params_.extra_chrome_arguments = extra_chrome_arguments;
-  chrome_launch_params_.perform_version_check = perform_version_check;
-  chrome_launch_params_.url = navigate_after_initialization_ ? GURL() : url_;
-  chrome_launch_params_.incognito_mode = incognito;
+  if (!navigate_after_initialization_) {
+    chrome_launch_params_.url = url_;
+  }
 
   proxy_factory_->GetAutomationServer(
       static_cast<ProxyFactory::LaunchDelegate*>(this),
@@ -830,6 +823,7 @@ void ChromeFrameAutomationClient::CreateExternalTab() {
     handle_top_level_requests_,
     chrome_launch_params_.url,
     chrome_launch_params_.referrer,
+    !chrome_launch_params_.is_widget_mode  // Infobars disabled in widget mode.
   };
 
   THREAD_SAFE_UMA_HISTOGRAM_CUSTOM_COUNTS(
diff --git a/chrome_frame/chrome_frame_automation.h b/chrome_frame/chrome_frame_automation.h
index 8a7c54ad0691f..6c0d895ea785b 100644
--- a/chrome_frame/chrome_frame_automation.h
+++ b/chrome_frame/chrome_frame_automation.h
@@ -84,11 +84,12 @@ struct ChromeFrameLaunchParams {
   int automation_server_launch_timeout;
   GURL url;
   GURL referrer;
+  FilePath profile_path;
   std::wstring profile_name;
   std::wstring extra_chrome_arguments;
   bool perform_version_check;
   bool incognito_mode;
-  FilePath profile_path;
+  bool is_widget_mode;
 };
 
 // We must create and destroy automation proxy in a thread with a message loop.
@@ -159,11 +160,7 @@ class ChromeFrameAutomationClient
 
   // Called from UI thread.
   virtual bool Initialize(ChromeFrameDelegate* chrome_frame_delegate,
-                          int automation_server_launch_timeout,
-                          bool perform_version_check,
-                          const FilePath& profile_path,
-                          const std::wstring& extra_chrome_arguments,
-                          bool incognito);
+                          const ChromeFrameLaunchParams& chrome_launch_params);
   void Uninitialize();
 
   virtual bool InitiateNavigation(const std::string& url,
diff --git a/chrome_frame/chrome_frame_npapi.cc b/chrome_frame/chrome_frame_npapi.cc
index 573d32e841e68..6fbd76a58751d 100644
--- a/chrome_frame/chrome_frame_npapi.cc
+++ b/chrome_frame/chrome_frame_npapi.cc
@@ -320,7 +320,7 @@ bool ChromeFrameNPAPI::Initialize(NPMIMEType mime_type, NPP instance,
   // TODO(stoyan): Ask host for specific interface whether to honor
   // host's in-private mode.
   return InitializeAutomation(profile_name, extra_arguments,
-                              GetBrowserIncognitoMode());
+                              GetBrowserIncognitoMode(), true);
 }
 
 void ChromeFrameNPAPI::Uninitialize() {
diff --git a/chrome_frame/chrome_frame_npapi_unittest.cc b/chrome_frame/chrome_frame_npapi_unittest.cc
index 6af670d7303c2..e845bb5473e8b 100644
--- a/chrome_frame/chrome_frame_npapi_unittest.cc
+++ b/chrome_frame/chrome_frame_npapi_unittest.cc
@@ -19,6 +19,7 @@ namespace {
 
 using ::testing::_;
 using ::testing::Eq;
+using ::testing::Field;
 using ::testing::Invoke;
 using ::testing::Return;
 using ::testing::StrEq;
@@ -79,9 +80,8 @@ class MockNPAPI: public ChromeFrameNPAPI {
 
 class MockAutomationClient: public ChromeFrameAutomationClient {
  public:
-  MOCK_METHOD6(Initialize, bool(ChromeFrameDelegate*, int, bool,
-                                const FilePath&, const std::wstring&,
-                                bool));
+  MOCK_METHOD2(Initialize, bool(ChromeFrameDelegate*,
+                                const ChromeFrameLaunchParams&));
   MOCK_METHOD1(SetEnableExtensionAutomation,
                void(const std::vector<std::string>&));  // NOLINT
 };
@@ -126,7 +126,12 @@ class TestNPAPIPrivilegedApi: public ::testing::Test {
     EXPECT_CALL(*mock_proxy, Initialize(_, _)).WillRepeatedly(Return(false));
 
     EXPECT_CALL(*mock_automation,
-        Initialize(_, _, true, _, StrEq(extra_args), false))
+        Initialize(_, AllOf(
+            Field(&ChromeFrameLaunchParams::perform_version_check, true),
+            Field(&ChromeFrameLaunchParams::extra_chrome_arguments,
+                StrEq(extra_args)),
+            Field(&ChromeFrameLaunchParams::incognito_mode, is_incognito),
+            Field(&ChromeFrameLaunchParams::is_widget_mode, true))))
         .WillOnce(Return(true));
 
     if (expect_privilege_check) {
diff --git a/chrome_frame/chrome_frame_plugin.h b/chrome_frame/chrome_frame_plugin.h
index 7f397e6a67bb4..c7b0598d245cc 100644
--- a/chrome_frame/chrome_frame_plugin.h
+++ b/chrome_frame/chrome_frame_plugin.h
@@ -58,16 +58,25 @@ END_MSG_MAP()
 
   bool InitializeAutomation(const std::wstring& profile_name,
                             const std::wstring& extra_chrome_arguments,
-                            bool incognito) {
+                            bool incognito, bool is_widget_mode) {
     DCHECK(IsValid());
     // We don't want to do incognito when privileged, since we're
     // running in browser chrome or some other privileged context.
     bool incognito_mode = !is_privileged_ && incognito;
     FilePath profile_path;
     GetProfilePath(profile_name, &profile_path);
-    return automation_client_->Initialize(this, kCommandExecutionTimeout, true,
-                                          profile_path, extra_chrome_arguments,
-                                          incognito_mode);
+    ChromeFrameLaunchParams chrome_launch_params = {
+      kCommandExecutionTimeout,
+      GURL(),
+      GURL(),
+      profile_path,
+      profile_name,
+      extra_chrome_arguments,
+      true,
+      incognito_mode,
+      is_widget_mode
+    };
+    return automation_client_->Initialize(this, chrome_launch_params);
   }
 
   // ChromeFrameDelegate implementation
diff --git a/chrome_frame/delete_chrome_history.cc b/chrome_frame/delete_chrome_history.cc
index 994d60907d54c..26633f06ae524 100644
--- a/chrome_frame/delete_chrome_history.cc
+++ b/chrome_frame/delete_chrome_history.cc
@@ -57,7 +57,7 @@ STDMETHODIMP DeleteChromeHistory::DeleteBrowsingHistory(DWORD flags) {
   // in lieu of sending an IPC when it seems appropriate. Since we assume this
   // happens in one-off fashion, don't attempt to pack REMOVE_* arguments.
   // Instead, have the browser process clobber all history.
-  if (!InitializeAutomation(GetHostProcessName(false), L"", false)) {
+  if (!InitializeAutomation(GetHostProcessName(false), L"", false, false)) {
     return E_UNEXPECTED;
   }
 
diff --git a/chrome_frame/test/automation_client_mock.cc b/chrome_frame/test/automation_client_mock.cc
index 36edc57a87353..de1736cf88717 100644
--- a/chrome_frame/test/automation_client_mock.cc
+++ b/chrome_frame/test/automation_client_mock.cc
@@ -101,8 +101,18 @@ TEST(CFACWithChrome, CreateTooFast) {
       .Times(1)
       .WillOnce(QUIT_LOOP(loop));
 
-  EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile_path, L"",
-                                 false));
+  ChromeFrameLaunchParams clp = {
+    timeout,
+    GURL(),
+    GURL(),
+    profile_path,
+    profile_path.BaseName().value(),
+    L"",
+    false,
+    false,
+    false
+  };
+  EXPECT_TRUE(client->Initialize(&cfd, clp));
   loop.RunFor(10);
   client->Uninitialize();
 }
@@ -128,8 +138,18 @@ TEST(CFACWithChrome, CreateNotSoFast) {
   EXPECT_CALL(cfd, OnAutomationServerLaunchFailed(_, _))
       .Times(0);
 
-  EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile_path, L"",
-                                 false));
+  ChromeFrameLaunchParams clp = {
+    timeout,
+    GURL(),
+    GURL(),
+    profile_path,
+    profile_path.BaseName().value(),
+    L"",
+    false,
+    false,
+    false
+  };
+  EXPECT_TRUE(client->Initialize(&cfd, clp));
 
   loop.RunFor(11);
   client->Uninitialize();
@@ -170,8 +190,18 @@ TEST(CFACWithChrome, NavigateOk) {
         .WillOnce(QUIT_LOOP(loop));
   }
 
-  EXPECT_TRUE(client->Initialize(&cfd, timeout, false, profile_path, L"",
-                                 false));
+  ChromeFrameLaunchParams clp = {
+    timeout,
+    GURL(),
+    GURL(),
+    profile_path,
+    profile_path.BaseName().value(),
+    L"",
+    false,
+    false,
+    false
+  };
+  EXPECT_TRUE(client->Initialize(&cfd, clp));
   loop.RunFor(10);
   client->Uninitialize();
   client = NULL;
@@ -211,8 +241,18 @@ TEST(CFACWithChrome, NavigateFailed) {
       .Times(1)
       .WillOnce(QUIT_LOOP_SOON(loop, 2));
 
-  EXPECT_TRUE(client->Initialize(&cfd, 10000, false, profile_path, L"",
-                                 false));
+  ChromeFrameLaunchParams clp = {
+    10000,
+    GURL(),
+    GURL(),
+    profile_path,
+    profile_path.BaseName().value(),
+    L"",
+    false,
+    false,
+    false
+  };
+  EXPECT_TRUE(client->Initialize(&cfd, clp));
 
   loop.RunFor(10);
   client->Uninitialize();
@@ -245,8 +285,18 @@ TEST_F(CFACMockTest, MockedCreateTabOk) {
   EXPECT_CALL(proxy_, CancelAsync(_)).Times(testing::AnyNumber());
 
   // Here we go!
-  EXPECT_TRUE(client_->Initialize(&cfd_, timeout, false, profile_path_, L"",
-                                  false));
+  ChromeFrameLaunchParams clp = {
+    timeout,
+    GURL(),
+    GURL(),
+    profile_path_,
+    profile_path_.BaseName().value(),
+    L"",
+    false,
+    false,
+    false
+  };
+  EXPECT_TRUE(client_->Initialize(&cfd_, clp));
   loop_.RunFor(10);
   client_->Uninitialize();
 }
@@ -271,8 +321,18 @@ TEST_F(CFACMockTest, MockedCreateTabFailed) {
   Set_CFD_LaunchFailed(AUTOMATION_CREATE_TAB_FAILED);
 
   // Here we go!
-  EXPECT_TRUE(client_->Initialize(&cfd_, timeout_, false, profile_path_, L"",
-              false));
+  ChromeFrameLaunchParams clp = {
+    timeout_,
+    GURL(),
+    GURL(),
+    profile_path_,
+    profile_path_.BaseName().value(),
+    L"",
+    false,
+    false,
+    false
+  };
+  EXPECT_TRUE(client_->Initialize(&cfd_, clp));
   loop_.RunFor(4);
   client_->Uninitialize();
 }
diff --git a/chrome_frame/test/chrome_frame_automation_mock.h b/chrome_frame/test/chrome_frame_automation_mock.h
index 11d186f52f7eb..141fb9c81e1cd 100644
--- a/chrome_frame/test/chrome_frame_automation_mock.h
+++ b/chrome_frame/test/chrome_frame_automation_mock.h
@@ -22,7 +22,8 @@ class AutomationMockDelegate
   AutomationMockDelegate(MessageLoop* caller_message_loop,
       int launch_timeout, bool perform_version_check,
       const std::wstring& profile_name,
-      const std::wstring& extra_chrome_arguments, bool incognito)
+      const std::wstring& extra_chrome_arguments, bool incognito,
+      bool is_widget_mode)
       : caller_message_loop_(caller_message_loop), is_connected_(false),
         navigation_result_(false) {
     test_server_.SetUp();
@@ -31,8 +32,18 @@ class AutomationMockDelegate
         chrome_frame_test::GetProfilePath(profile_name));
 
     automation_client_ = new ChromeFrameAutomationClient;
-    automation_client_->Initialize(this, launch_timeout, perform_version_check,
-        profile_path, extra_chrome_arguments, incognito);
+    ChromeFrameLaunchParams clp = {
+      launch_timeout,
+      GURL(),
+      GURL(),
+      profile_path,
+      profile_name,
+      extra_chrome_arguments,
+      perform_version_check,
+      incognito,
+      is_widget_mode
+    };
+    automation_client_->Initialize(this, clp);
   }
   ~AutomationMockDelegate() {
     if (automation_client_.get()) {
@@ -136,7 +147,8 @@ class AutomationMockLaunch
   typedef AutomationMockDelegate<AutomationMockLaunch> Base;
   AutomationMockLaunch(MessageLoop* caller_message_loop,
                        int launch_timeout)
-      : Base(caller_message_loop, launch_timeout, true, L"", L"", false) {
+      : Base(caller_message_loop, launch_timeout, true, L"", L"", false,
+             false) {
   }
   virtual void OnAutomationServerReady() {
     Base::OnAutomationServerReady();
@@ -153,7 +165,8 @@ class AutomationMockNavigate
   typedef AutomationMockDelegate<AutomationMockNavigate> Base;
   AutomationMockNavigate(MessageLoop* caller_message_loop,
                          int launch_timeout)
-      : Base(caller_message_loop, launch_timeout, true, L"", L"", false) {
+      : Base(caller_message_loop, launch_timeout, true, L"", L"", false,
+             false) {
   }
   virtual void OnLoad(int tab_handle, const GURL& url) {
     Base::OnLoad(tab_handle, url);
@@ -167,7 +180,7 @@ class AutomationMockPostMessage
   typedef AutomationMockDelegate<AutomationMockPostMessage> Base;
   AutomationMockPostMessage(MessageLoop* caller_message_loop,
                             int launch_timeout)
-      : Base(caller_message_loop, launch_timeout, true, L"", L"", false),
+      : Base(caller_message_loop, launch_timeout, true, L"", L"", false, false),
         postmessage_result_(false) {}
   bool postmessage_result() const {
     return postmessage_result_;
@@ -195,7 +208,7 @@ class AutomationMockHostNetworkRequestStart
   typedef AutomationMockDelegate<AutomationMockHostNetworkRequestStart> Base;
   AutomationMockHostNetworkRequestStart(MessageLoop* caller_message_loop,
       int launch_timeout)
-      : Base(caller_message_loop, launch_timeout, true, L"", L"", false),
+      : Base(caller_message_loop, launch_timeout, true, L"", L"", false, false),
         request_start_result_(false) {
     if (automation()) {
       automation()->set_use_chrome_network(false);
-- 
GitLab