OLD | NEW |
1 // Copyright (c) 2012 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 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/bookmarks/bookmark_model.h" | 8 #include "chrome/browser/bookmarks/bookmark_model.h" |
9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
10 #include "chrome/browser/bookmarks/bookmark_utils.h" | 10 #include "chrome/browser/bookmarks/bookmark_utils.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 scoped_ptr<LazyBackgroundObserver> original_complete_; | 71 scoped_ptr<LazyBackgroundObserver> original_complete_; |
72 scoped_ptr<LazyBackgroundObserver> incognito_complete_; | 72 scoped_ptr<LazyBackgroundObserver> incognito_complete_; |
73 }; | 73 }; |
74 | 74 |
75 } // namespace | 75 } // namespace |
76 | 76 |
77 class LazyBackgroundPageApiTest : public ExtensionApiTest { | 77 class LazyBackgroundPageApiTest : public ExtensionApiTest { |
78 public: | 78 public: |
79 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 79 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
80 ExtensionApiTest::SetUpCommandLine(command_line); | 80 ExtensionApiTest::SetUpCommandLine(command_line); |
81 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | |
82 // Set shorter delays to prevent test timeouts. | 81 // Set shorter delays to prevent test timeouts. |
83 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); | 82 command_line->AppendSwitchASCII(switches::kEventPageIdleTime, "1"); |
84 command_line->AppendSwitchASCII(switches::kEventPageSuspendingTime, "1"); | 83 command_line->AppendSwitchASCII(switches::kEventPageSuspendingTime, "1"); |
85 } | 84 } |
86 | 85 |
87 // Loads the extension, which temporarily starts the lazy background page | 86 // Loads the extension, which temporarily starts the lazy background page |
88 // to dispatch the onInstalled event. We wait until it shuts down again. | 87 // to dispatch the onInstalled event. We wait until it shuts down again. |
89 const Extension* LoadExtensionAndWait(const std::string& test_name) { | 88 const Extension* LoadExtensionAndWait(const std::string& test_name) { |
90 LazyBackgroundObserver page_complete; | 89 LazyBackgroundObserver page_complete; |
91 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). | 90 base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 453 |
455 EXPECT_TRUE(event_page_ready.WaitUntilSatisfied()); | 454 EXPECT_TRUE(event_page_ready.WaitUntilSatisfied()); |
456 | 455 |
457 page_ready.Reply("go"); | 456 page_ready.Reply("go"); |
458 | 457 |
459 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 458 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
460 } | 459 } |
461 | 460 |
462 // TODO: background page with timer. | 461 // TODO: background page with timer. |
463 // TODO: background page that interacts with popup. | 462 // TODO: background page that interacts with popup. |
OLD | NEW |