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

Side by Side Diff: chrome_frame/test/chrome_frame_automation_mock.h

Issue 9460019: Reduce flakiness in chrome_frame_tests.exe by having each run in a clean environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed compile break Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ 5 #ifndef CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_
6 #define CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ 6 #define CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/file_path.h" 10 #include "base/file_path.h"
11 #include "base/path_service.h" 11 #include "base/path_service.h"
12 #include "base/utf_string_conversions.h" 12 #include "base/utf_string_conversions.h"
13 #include "chrome/common/chrome_switches.h" 13 #include "chrome/common/chrome_switches.h"
14 #include "chrome_frame/chrome_frame_automation.h" 14 #include "chrome_frame/chrome_frame_automation.h"
15 #include "chrome_frame/chrome_frame_plugin.h" 15 #include "chrome_frame/chrome_frame_plugin.h"
16 #include "chrome_frame/navigation_constraints.h" 16 #include "chrome_frame/navigation_constraints.h"
17 #include "chrome_frame/test/chrome_frame_test_utils.h" 17 #include "chrome_frame/test/chrome_frame_test_utils.h"
18 #include "chrome_frame/test/test_scrubber.h"
18 #include "chrome_frame/test/test_with_web_server.h" 19 #include "chrome_frame/test/test_with_web_server.h"
19 #include "chrome_frame/utils.h" 20 #include "chrome_frame/utils.h"
20 21
21 template <typename T> 22 template <typename T>
22 class AutomationMockDelegate 23 class AutomationMockDelegate
23 : public CWindowImpl<T>, 24 : public CWindowImpl<T>,
24 public ChromeFramePlugin<T> { 25 public ChromeFramePlugin<T> {
25 public: 26 public:
26 AutomationMockDelegate(MessageLoop* caller_message_loop, 27 AutomationMockDelegate(MessageLoop* caller_message_loop,
27 int launch_timeout, bool perform_version_check, 28 int launch_timeout, bool perform_version_check,
28 const std::wstring& profile_name, 29 const std::wstring& profile_name,
29 const std::wstring& language, 30 const std::wstring& language,
30 bool incognito, bool is_widget_mode) 31 bool incognito, bool is_widget_mode)
31 : caller_message_loop_(caller_message_loop), is_connected_(false), 32 : caller_message_loop_(caller_message_loop), is_connected_(false),
32 navigation_result_(false), 33 navigation_result_(false),
33 mock_server_(1337, L"127.0.0.1", 34 mock_server_(1337, L"127.0.0.1",
34 chrome_frame_test::GetTestDataFolder()) { 35 chrome_frame_test::GetTestDataFolder()) {
35 36
36 // Endeavour to only kill off Chrome Frame derived Chrome processes. 37 // Endeavour to only kill off Chrome Frame derived Chrome processes.
37 KillAllNamedProcessesWithArgument( 38 KillAllNamedProcessesWithArgument(
38 UTF8ToWide(chrome_frame_test::kChromeImageName), 39 UTF8ToWide(chrome_frame_test::kChromeImageName),
39 UTF8ToWide(switches::kChromeFrame)); 40 UTF8ToWide(switches::kChromeFrame));
40 41
41 mock_server_.ExpectAndServeAnyRequests(CFInvocation(CFInvocation::NONE)); 42 mock_server_.ExpectAndServeAnyRequests(CFInvocation(CFInvocation::NONE));
42 43
43 FilePath profile_path( 44 FilePath profile_path(
44 chrome_frame_test::GetProfilePath(profile_name)); 45 chrome_frame_test::GetProfilePath(profile_name));
46 chrome_frame_test::OverrideDataDirectoryForThisTest(profile_path.value());
45 47
46 automation_client_ = new ChromeFrameAutomationClient; 48 automation_client_ = new ChromeFrameAutomationClient;
47 GURL empty; 49 GURL empty;
48 scoped_refptr<ChromeFrameLaunchParams> clp( 50 scoped_refptr<ChromeFrameLaunchParams> clp(
49 new ChromeFrameLaunchParams(empty, empty, profile_path, profile_name, 51 new ChromeFrameLaunchParams(empty, empty, profile_path, profile_name,
50 language, incognito, is_widget_mode, false)); 52 language, incognito, is_widget_mode, false));
51 clp->set_launch_timeout(launch_timeout); 53 clp->set_launch_timeout(launch_timeout);
52 clp->set_version_check(perform_version_check); 54 clp->set_version_check(perform_version_check);
53 automation_client_->Initialize(this, clp); 55 automation_client_->Initialize(this, clp);
54 } 56 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 QuitMessageLoop(); 231 QuitMessageLoop();
230 } 232 }
231 virtual void OnLoad(const GURL& url) { 233 virtual void OnLoad(const GURL& url) {
232 Base::OnLoad(url); 234 Base::OnLoad(url);
233 } 235 }
234 private: 236 private:
235 bool request_start_result_; 237 bool request_start_result_;
236 }; 238 };
237 239
238 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_ 240 #endif // CHROME_FRAME_TEST_CHROME_FRAME_AUTOMATION_MOCK_H_
OLDNEW
« no previous file with comments | « chrome_frame/test/automation_client_mock.cc ('k') | chrome_frame/test/chrome_frame_automation_mock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698