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

Side by Side Diff: shell/native_runner_unittest.cc

Issue 1067173003: Remove mojo:: part of mojo::shell:: nested namespace in //shell. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 8 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 "base/files/scoped_temp_dir.h" 5 #include "base/files/scoped_temp_dir.h"
6 #include "shell/application_manager/application_manager.h" 6 #include "shell/application_manager/application_manager.h"
7 #include "shell/context.h" 7 #include "shell/context.h"
8 #include "shell/filename_util.h" 8 #include "shell/filename_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace mojo {
12 namespace shell { 11 namespace shell {
13 namespace { 12 namespace {
14 13
15 struct TestState { 14 struct TestState {
16 TestState() 15 TestState()
17 : runner_was_created(false), 16 : runner_was_created(false),
18 runner_was_started(false), 17 runner_was_started(false),
19 runner_was_destroyed(false) {} 18 runner_was_destroyed(false) {}
20 19
21 bool runner_was_created; 20 bool runner_was_created;
22 bool runner_was_started; 21 bool runner_was_started;
23 bool runner_was_destroyed; 22 bool runner_was_destroyed;
24 }; 23 };
25 24
26 class TestNativeRunner : public NativeRunner { 25 class TestNativeRunner : public NativeRunner {
27 public: 26 public:
28 explicit TestNativeRunner(TestState* state) : state_(state) { 27 explicit TestNativeRunner(TestState* state) : state_(state) {
29 state_->runner_was_created = true; 28 state_->runner_was_created = true;
30 } 29 }
31 ~TestNativeRunner() override { 30 ~TestNativeRunner() override {
32 state_->runner_was_destroyed = true; 31 state_->runner_was_destroyed = true;
33 base::MessageLoop::current()->Quit(); 32 base::MessageLoop::current()->Quit();
34 } 33 }
35 void Start(const base::FilePath& app_path, 34 void Start(const base::FilePath& app_path,
36 NativeApplicationCleanup cleanup, 35 NativeApplicationCleanup cleanup,
37 InterfaceRequest<Application> application_request, 36 mojo::InterfaceRequest<mojo::Application> application_request,
38 const base::Closure& app_completed_callback) override { 37 const base::Closure& app_completed_callback) override {
39 state_->runner_was_started = true; 38 state_->runner_was_started = true;
40 } 39 }
41 40
42 private: 41 private:
43 TestState* state_; 42 TestState* state_;
44 }; 43 };
45 44
46 class TestNativeRunnerFactory : public NativeRunnerFactory { 45 class TestNativeRunnerFactory : public NativeRunnerFactory {
47 public: 46 public:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 GURL ResolveURL(const GURL& url) override { return url; } 80 GURL ResolveURL(const GURL& url) override { return url; }
82 81
83 GURL ResolveMappings(const GURL& url) override { return url; } 82 GURL ResolveMappings(const GURL& url) override { return url; }
84 }; 83 };
85 84
86 TEST_F(NativeApplicationLoaderTest, DoesNotExist) { 85 TEST_F(NativeApplicationLoaderTest, DoesNotExist) {
87 base::ScopedTempDir temp_dir; 86 base::ScopedTempDir temp_dir;
88 ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); 87 ASSERT_TRUE(temp_dir.CreateUniqueTempDir());
89 base::FilePath nonexistent_file(FILE_PATH_LITERAL("nonexistent.txt")); 88 base::FilePath nonexistent_file(FILE_PATH_LITERAL("nonexistent.txt"));
90 GURL url(FilePathToFileURL(temp_dir.path().Append(nonexistent_file))); 89 GURL url(FilePathToFileURL(temp_dir.path().Append(nonexistent_file)));
91 InterfaceRequest<ServiceProvider> services; 90 mojo::InterfaceRequest<mojo::ServiceProvider> services;
92 ServiceProviderPtr service_provider; 91 mojo::ServiceProviderPtr service_provider;
93 application_manager_.ConnectToApplication( 92 application_manager_.ConnectToApplication(
94 url, GURL(), services.Pass(), service_provider.Pass(), base::Closure()); 93 url, GURL(), services.Pass(), service_provider.Pass(), base::Closure());
95 EXPECT_FALSE(state_.runner_was_created); 94 EXPECT_FALSE(state_.runner_was_created);
96 EXPECT_FALSE(state_.runner_was_started); 95 EXPECT_FALSE(state_.runner_was_started);
97 EXPECT_FALSE(state_.runner_was_destroyed); 96 EXPECT_FALSE(state_.runner_was_destroyed);
98 } 97 }
99 98
100 } // namespace 99 } // namespace
101 } // namespace shell 100 } // namespace shell
102 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698