OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/test/chromedriver/chrome_launcher.h" | 5 #include "chrome/test/chromedriver/chrome_launcher.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/base64.h" | 10 #include "base/base64.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 } | 271 } |
272 return status; | 272 return status; |
273 } | 273 } |
274 scoped_ptr<ChromeDesktopImpl> chrome_desktop( | 274 scoped_ptr<ChromeDesktopImpl> chrome_desktop( |
275 new ChromeDesktopImpl(devtools_client.Pass(), | 275 new ChromeDesktopImpl(devtools_client.Pass(), |
276 devtools_event_listeners, | 276 devtools_event_listeners, |
277 process, | 277 process, |
278 &user_data_dir, | 278 &user_data_dir, |
279 &extension_dir)); | 279 &extension_dir)); |
280 for (size_t i = 0; i < extension_bg_pages.size(); ++i) { | 280 for (size_t i = 0; i < extension_bg_pages.size(); ++i) { |
281 VLOG(0) << "Waiting for extension bg page load: " << extension_bg_pages[i]; | |
281 scoped_ptr<WebView> web_view; | 282 scoped_ptr<WebView> web_view; |
282 Status status = chrome_desktop->WaitForPageToLoad( | 283 Status status = chrome_desktop->WaitForPageToLoad( |
chrisgao (Use stgao instead)
2013/09/06 21:20:13
Will this also wait for the automation extension?
kkania
2013/09/06 23:09:29
It does not.
| |
283 extension_bg_pages[i], base::TimeDelta::FromSeconds(10), &web_view); | 284 extension_bg_pages[i], base::TimeDelta::FromSeconds(10), &web_view); |
284 if (status.IsError()) { | 285 if (status.IsError()) { |
285 return Status(kUnknownError, | 286 return Status(kUnknownError, |
286 "failed to wait for extension background page to load: " + | 287 "failed to wait for extension background page to load: " + |
287 extension_bg_pages[i], | 288 extension_bg_pages[i], |
288 status); | 289 status); |
289 } | 290 } |
290 } | 291 } |
291 *chrome = chrome_desktop.Pass(); | 292 *chrome = chrome_desktop.Pass(); |
292 return Status(kOk); | 293 return Status(kOk); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
551 | 552 |
552 if (custom_prefs) { | 553 if (custom_prefs) { |
553 for (base::DictionaryValue::Iterator it(*custom_prefs); !it.IsAtEnd(); | 554 for (base::DictionaryValue::Iterator it(*custom_prefs); !it.IsAtEnd(); |
554 it.Advance()) { | 555 it.Advance()) { |
555 prefs->Set(it.key(), it.value().DeepCopy()); | 556 prefs->Set(it.key(), it.value().DeepCopy()); |
556 } | 557 } |
557 } | 558 } |
558 | 559 |
559 std::string prefs_str; | 560 std::string prefs_str; |
560 base::JSONWriter::Write(prefs, &prefs_str); | 561 base::JSONWriter::Write(prefs, &prefs_str); |
562 VLOG(0) << "Populating " << path.BaseName().value() | |
563 << " file: " << PrettyPrintValue(*prefs); | |
561 if (static_cast<int>(prefs_str.length()) != file_util::WriteFile( | 564 if (static_cast<int>(prefs_str.length()) != file_util::WriteFile( |
562 path, prefs_str.c_str(), prefs_str.length())) { | 565 path, prefs_str.c_str(), prefs_str.length())) { |
563 return Status(kUnknownError, "failed to write prefs file"); | 566 return Status(kUnknownError, "failed to write prefs file"); |
564 } | 567 } |
565 return Status(kOk); | 568 return Status(kOk); |
566 } | 569 } |
567 | 570 |
568 Status PrepareUserDataDir( | 571 Status PrepareUserDataDir( |
569 const base::FilePath& user_data_dir, | 572 const base::FilePath& user_data_dir, |
570 const base::DictionaryValue* custom_prefs, | 573 const base::DictionaryValue* custom_prefs, |
(...skipping 19 matching lines...) Expand all Loading... | |
590 // Write empty "First Run" file, otherwise Chrome will wipe the default | 593 // Write empty "First Run" file, otherwise Chrome will wipe the default |
591 // profile that was written. | 594 // profile that was written. |
592 if (file_util::WriteFile( | 595 if (file_util::WriteFile( |
593 user_data_dir.AppendASCII("First Run"), "", 0) != 0) { | 596 user_data_dir.AppendASCII("First Run"), "", 0) != 0) { |
594 return Status(kUnknownError, "failed to write first run file"); | 597 return Status(kUnknownError, "failed to write first run file"); |
595 } | 598 } |
596 return Status(kOk); | 599 return Status(kOk); |
597 } | 600 } |
598 | 601 |
599 } // namespace internal | 602 } // namespace internal |
OLD | NEW |