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

Side by Side Diff: mojo/application_manager/background_shell_application_loader_unittest.cc

Issue 506103002: Rename ApplicationLoader::OnServiceError to OnApplicationError (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge nits Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/application_manager/background_shell_application_loader.h" 5 #include "mojo/application_manager/background_shell_application_loader.h"
6 6
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 10
11 namespace { 11 namespace {
12 12
13 class DummyLoader : public ApplicationLoader { 13 class DummyLoader : public ApplicationLoader {
14 public: 14 public:
15 DummyLoader() : simulate_app_quit_(true) {} 15 DummyLoader() : simulate_app_quit_(true) {}
16 virtual ~DummyLoader() {} 16 virtual ~DummyLoader() {}
17 17
18 // ApplicationLoader overrides: 18 // ApplicationLoader overrides:
19 virtual void Load(ApplicationManager* manager, 19 virtual void Load(ApplicationManager* manager,
20 const GURL& url, 20 const GURL& url,
21 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE { 21 scoped_refptr<LoadCallbacks> callbacks) OVERRIDE {
22 if (simulate_app_quit_) 22 if (simulate_app_quit_)
23 base::MessageLoop::current()->Quit(); 23 base::MessageLoop::current()->Quit();
24 } 24 }
25 25
26 virtual void OnServiceError(ApplicationManager* manager, 26 virtual void OnApplicationError(ApplicationManager* manager,
27 const GURL& url) OVERRIDE {} 27 const GURL& url) OVERRIDE {}
28 28
29 void DontSimulateAppQuit() { simulate_app_quit_ = false; } 29 void DontSimulateAppQuit() { simulate_app_quit_ = false; }
30 30
31 private: 31 private:
32 bool simulate_app_quit_; 32 bool simulate_app_quit_;
33 }; 33 };
34 34
35 } // namespace 35 } // namespace
36 36
37 // Tests that the loader can start and stop gracefully. 37 // Tests that the loader can start and stop gracefully.
38 TEST(BackgroundShellApplicationLoaderTest, StartStop) { 38 TEST(BackgroundShellApplicationLoaderTest, StartStop) {
39 scoped_ptr<ApplicationLoader> real_loader(new DummyLoader()); 39 scoped_ptr<ApplicationLoader> real_loader(new DummyLoader());
40 BackgroundShellApplicationLoader loader( 40 BackgroundShellApplicationLoader loader(
41 real_loader.Pass(), "test", base::MessageLoop::TYPE_DEFAULT); 41 real_loader.Pass(), "test", base::MessageLoop::TYPE_DEFAULT);
42 } 42 }
43 43
44 // Tests that the loader can load a service that is well behaved (quits 44 // Tests that the loader can load a service that is well behaved (quits
45 // itself). 45 // itself).
46 TEST(BackgroundShellApplicationLoaderTest, Load) { 46 TEST(BackgroundShellApplicationLoaderTest, Load) {
47 scoped_ptr<ApplicationLoader> real_loader(new DummyLoader()); 47 scoped_ptr<ApplicationLoader> real_loader(new DummyLoader());
48 BackgroundShellApplicationLoader loader( 48 BackgroundShellApplicationLoader loader(
49 real_loader.Pass(), "test", base::MessageLoop::TYPE_DEFAULT); 49 real_loader.Pass(), "test", base::MessageLoop::TYPE_DEFAULT);
50 MessagePipe dummy; 50 MessagePipe dummy;
51 scoped_refptr<ApplicationLoader::SimpleLoadCallbacks> callbacks( 51 scoped_refptr<ApplicationLoader::SimpleLoadCallbacks> callbacks(
52 new ApplicationLoader::SimpleLoadCallbacks(dummy.handle0.Pass())); 52 new ApplicationLoader::SimpleLoadCallbacks(dummy.handle0.Pass()));
53 loader.Load(NULL, GURL(), callbacks); 53 loader.Load(NULL, GURL(), callbacks);
54 } 54 }
55 55
56 } // namespace mojo 56 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698