| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/cancelable_callback.h" | 6 #include "base/cancelable_callback.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 class BrowserClosedObserver : public content::NotificationObserver { | 53 class BrowserClosedObserver : public content::NotificationObserver { |
| 54 public: | 54 public: |
| 55 explicit BrowserClosedObserver(Browser* browser) { | 55 explicit BrowserClosedObserver(Browser* browser) { |
| 56 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, | 56 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSED, |
| 57 content::Source<Browser>(browser)); | 57 content::Source<Browser>(browser)); |
| 58 content::RunMessageLoop(); | 58 content::RunMessageLoop(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual void Observe(int type, | 61 virtual void Observe(int type, |
| 62 const content::NotificationSource& source, | 62 const content::NotificationSource& source, |
| 63 const content::NotificationDetails& details) { | 63 const content::NotificationDetails& details) OVERRIDE { |
| 64 MessageLoopForUI::current()->Quit(); | 64 MessageLoopForUI::current()->Quit(); |
| 65 } | 65 } |
| 66 | 66 |
| 67 private: | 67 private: |
| 68 content::NotificationRegistrar registrar_; | 68 content::NotificationRegistrar registrar_; |
| 69 DISALLOW_COPY_AND_ASSIGN(BrowserClosedObserver); | 69 DISALLOW_COPY_AND_ASSIGN(BrowserClosedObserver); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // The delay waited in some cases where we don't have a notifications for an | 72 // The delay waited in some cases where we don't have a notifications for an |
| 73 // action we take. | 73 // action we take. |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 if (!(*iter)->IsLoading()) | 234 if (!(*iter)->IsLoading()) |
| 235 ++iter; | 235 ++iter; |
| 236 else | 236 else |
| 237 content::RunMessageLoop(); | 237 content::RunMessageLoop(); |
| 238 } | 238 } |
| 239 | 239 |
| 240 timeout.Cancel(); | 240 timeout.Cancel(); |
| 241 return true; | 241 return true; |
| 242 } | 242 } |
| 243 | 243 |
| 244 void Observe(int type, | 244 virtual void Observe(int type, |
| 245 const content::NotificationSource& source, | 245 const content::NotificationSource& source, |
| 246 const content::NotificationDetails& details) { | 246 const content::NotificationDetails& details) OVERRIDE { |
| 247 switch (type) { | 247 switch (type) { |
| 248 case chrome::NOTIFICATION_EXTENSION_LOADED: | 248 case chrome::NOTIFICATION_EXTENSION_LOADED: |
| 249 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: | 249 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: |
| 250 MessageLoopForUI::current()->Quit(); | 250 MessageLoopForUI::current()->Quit(); |
| 251 break; | 251 break; |
| 252 default: | 252 default: |
| 253 NOTREACHED(); | 253 NOTREACHED(); |
| 254 break; | 254 break; |
| 255 } | 255 } |
| 256 } | 256 } |
| 257 | 257 |
| 258 FilePath test_extensions_dir_; | 258 FilePath test_extensions_dir_; |
| 259 }; | 259 }; |
| 260 | 260 |
| 261 class DevToolsExperimentalExtensionTest : public DevToolsExtensionTest { | 261 class DevToolsExperimentalExtensionTest : public DevToolsExtensionTest { |
| 262 public: | 262 public: |
| 263 void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 263 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 264 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); | 264 command_line->AppendSwitch(switches::kEnableExperimentalExtensionApis); |
| 265 } | 265 } |
| 266 }; | 266 }; |
| 267 | 267 |
| 268 class WorkerDevToolsSanityTest : public InProcessBrowserTest { | 268 class WorkerDevToolsSanityTest : public InProcessBrowserTest { |
| 269 public: | 269 public: |
| 270 WorkerDevToolsSanityTest() : window_(NULL) {} | 270 WorkerDevToolsSanityTest() : window_(NULL) {} |
| 271 | 271 |
| 272 protected: | 272 protected: |
| 273 class WorkerData : public base::RefCountedThreadSafe<WorkerData> { | 273 class WorkerData : public base::RefCountedThreadSafe<WorkerData> { |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 content::CONSOLE_MESSAGE_LEVEL_LOG, | 584 content::CONSOLE_MESSAGE_LEVEL_LOG, |
| 585 "log"); | 585 "log"); |
| 586 devtools_manager->AddMessageToConsole(agent_host, | 586 devtools_manager->AddMessageToConsole(agent_host, |
| 587 content::CONSOLE_MESSAGE_LEVEL_ERROR, | 587 content::CONSOLE_MESSAGE_LEVEL_ERROR, |
| 588 "error"); | 588 "error"); |
| 589 RunTestFunction(window_, "checkLogAndErrorMessages"); | 589 RunTestFunction(window_, "checkLogAndErrorMessages"); |
| 590 CloseDevToolsWindow(); | 590 CloseDevToolsWindow(); |
| 591 } | 591 } |
| 592 | 592 |
| 593 } // namespace | 593 } // namespace |
| OLD | NEW |